2010-07-12 2 views
1

편집 :이 질문은 내가 만료 된 서버로 인해 유효하지 않습니다. 제발 무시해SOAP 및 PHP를 사용하여 PDF 파일 가져 오기

저는 PHP의 SoapClient에 익숙하지 않습니다. 세 가지 매개 변수를 전달하고 결과를 가져 와서 PDF를 가져 오려고합니다.

<?php 

header("content-type: application/pdf"); 

$client = new SoapClient('http://69.128.94.30:8080/4DSOAP/'); 
$result = $client->WS_ME_StatementRequest(array('FuneralHomeID' => '0008-00', 'Month' => 11, 'Year' => "2008")); 
$pdfdoc = $result->WS_ME_StatementResponse->StatementPDF; 
print($pdfdoc); 
:

<!-- this WSDL file was automatically generated by 4D --> 
<definitions name="A_WebService" targetNamespace="http://www.4d.com/namespace/default" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.4d.com/namespace/default" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <message name="WS_ME_StatementRequest"> 
     <part name="FuneralHomeID" type="xsd:string"/> 
     <part name="Month" type="xsd:int"/> 
     <part name="Year" type="xsd:string"/> 
    </message> 
    <message name="WS_ME_StatementResponse"> 
     <part name="StatementPDF" type="xsd:base64Binary"/> 
    </message> 
    <portType name="A_WebServiceRPC"> 
     <operation name="WS_ME_Statement"> 
      <input message="tns:WS_ME_StatementRequest"/> 
      <output message="tns:WS_ME_StatementResponse"/> 
     </operation> 
    </portType> 
    <binding name="A_WebServiceBinding" type="tns:A_WebServiceRPC"> 
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" /> 
     <operation name="WS_ME_Statement"> 
<documentation>Inputs: None 
Outputs: text variable</documentation> 
      <soap:operation soapAction="A_WebService#WS_ME_Statement"/> 
      <input> 
       <soap:body use="encoded" namespace="http://www.4d.com/namespace/default" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
      </input> 
      <output> 
       <soap:body use="encoded" namespace="http://www.4d.com/namespace/default" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
      </output> 
     </operation> 
    </binding> 
    <service name="A_WebService"> 
     <documentation></documentation> 
     <port name="A_WebServicePort" binding="tns:A_WebServiceBinding"> 
      <soap:address location="http://69.128.94.30:8080/4DSOAP/"/> 
     </port> 
    </service> 
</definitions> 

그리고 여기가 내가 지금까지 어떤 단지 404의를 반환 한 내용은 다음과 같습니다 여기에 내가 함께 일하고 있어요 WSDL 파일은 (난 정말이 부분 이상/모든 컨트롤 많지 않음)입니다

내가 뭘 잘못하고 있는지에 대한 아이디어가 있습니까?

+0

먼저 파일에 쓰십시오. –

답변

1

이 보이는 ..

header("content-type: application/pdf"); 

$client = new SoapClient('http://69.128.94.30:8080/4DSOAP/'); 
$result = $client->WS_ME_StatementRequest(array('FuneralHomeID' => '0008-00', 'Month' => 11, 'Year' => "2008")); 
echo base64_decode($result->WS_ME_StatementResponse->StatementPDF); 
+0

감사합니다. 혹시 그걸 시도 했니? 방금 시도했지만 아무 것도 변경하지 않은 것 같습니다. –

+0

나는 만료 메시지를받을 수 없다. 이진 파일에 쓰기를 시도해 보라! 해당 만료 메시지는 서버 오류처럼 보입니다. 브라우저에서 SEE : http://69.128.94.30:8080/4DSOAP/가 만료 된 제품에 대해 쿼리하지 않고 있는지 다시 확인하고 싶을 수 있습니다. –

+0

예, 서버가 게시 된 이후로 만료 된 것으로 보입니다. 좋은 타이밍 어? 어쨌든, 나는 우리가 지금 테스트 할 수 없기 때문에이 질문을 무시하도록 사람들에게 알리기 위해 OP를 업데이트했다. –

1

언뜻보기에 SoapClient URL이 잘못된 것처럼 보입니다. 보십시오 : 그것은 base64로 인코딩처럼

$client = new SoapClient('http://69.128.94.30:8080/4DSOAP/'); 
+0

아, 시험으로 변경 한 후 복사/붙여 넣기의 잘못입니다. 슬프게도 아무것도 바뀌지 않습니다. 나는 OP에서 그것을 고쳤다. –

1
나는 당신의 웹 서비스에 액세스 할 수 있기 때문에 나는이를 테스트 할 수 없습니다

(브라우저에 붙여 넣습니다 및 그것의 만료를 말한다) 그러나 나는 당신이 당신의 우두머리에 내용 길이와 처분을 지정할 필요가 있다고 믿는다.

$length = strlen($pdfdoc); 
header("Content-type: application/pdf"); 
header("Content-Length: $length"); 
header("Content-Disposition: attachment; filename=myfile.pdf"); 
관련 문제