2013-04-22 2 views
1

으로이 XML 파일을 보내려면 어떻게합니까 나는 내가 :-) 이해 thougt 뭔가 시간이 있었어요. 제공되는 웹 서비스에 SOAP xml 파일이 있습니다. 나는 이론을 ;-) 이해 생각하지만, 그것은 잘못된가는 계속되지 않도록. 어떻게 SOAP 및 PHP

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<soapenv:Body> 
    <exec xmlns="CBWSCallEngine" 
     soapenv:encodingStyle="http://xml.apache.org/xml-soap/literalxml"> 
     <arguments> 
      <CbOrderProduct xmlns="http://www.cbonline.nl/xsd"> 
       <Header> 
        <EndpointNm>xxxxxxx</EndpointNm> 
        <Certificaat>xxxxxxxx</Certificaat> 
       </Header> 
       <Detail> 
        <EAN>9789084999912</EAN> 
        <OrderReference>1988763767</OrderReference> 
        <ClientId>K Koning</ClientId> 
        <ReadingMethods>CR</ReadingMethods> 
        <RetailerId>xxxxxx</RetailerId> 
       </Detail> 
      </CbOrderProduct > 
     </arguments> 
    </exec> 
</soapenv:Body> 

는 I 배열에 공지 기능이 파일을 넣어. 그런 다음 서비스를 시작하지만 응답이 없습니다.

$url = "https://tst.eboekhuis.nl/cbwebs/CBWSCallEngine?WSDL"; 
$client = new SoapClient($url); 
$message = xml2array(file_get_contents('vraag.xml')); 
echo $result = $client->exec($message); 

누가 나를 도울 수 있습니까? 고정 고맙습니다. 내가 new SoapClient("https://tst.eboekhuis.nl/cbwebs/CBWSCallEngine?WSDL");를 호출 할 때

아드

+0

에 오신 것을 환영합니다. "잘못된 것"이 무엇을 의미하는지 더 잘 설명하기 위해 질문을 편집해야합니까? 델파이와 무슨 상관이 있습니까? – jachguate

+0

간부는 이름 간부 및 인수 –

+0

그냥 빈 화면이 뭔가를 보내 (인수) 입력을 exec0Request 있습니다. 오류가 없으면 화면에 간단한 반향이 나타납니다. – Aadv

답변

2

는 내가 가지고 : 치명적인 오류 : catch되지 않은 SOAPFault의 예외 : [WSDL] SOAP-오류 : 구문 분석 WSDL 'https://tst.eboekhuis.nl/cbwebs/CBWSCallEngine?WSDL'에서로드 할 수 없습니다 : "https://tst.eboekhuis.nl/cbwebs/CBWSCallEngine?WSDL을"외부 개체를로드하지 못했습니다 어쩌면 당신은 시도해야 SOAP-ERROR: Parsing WSDL: Couldn't load from <URL>

: 난에 이것에 대한 해결책을 발견하지 않았다 https://github.com/mikaelcom/WsdlToPhp. 난 당신의 코드를 좋아한다고 생각 :에 StackOverflow에

error_reporting(E_ALL); 
ini_set('display_errors', 1); 
class CbOrderProduct 
{ 
    var $header; 
    var $detail; 

    function __construct() 
    { 
       $this->header = new stdClass(); 
       $this->detail = new stdClass(); 
    } 
    function setheader($endpoint,$Certificaat) 
    { 
     $this->header->EndpointNm = $endpoint; 
     $this->header->Certificaat = $Certificaat; 
    } 

    function setdetail($ean,$orderreference,$clienid,$readingmethods,$retailerid) 
    { 
        $this->detail->EAN =$ean; 
        $this->detail->OrderReference = $orderreference; 
        $this->detail->ClientId = $clienid; 
        $this->detail->ReadingMethods = $readingmethods; 
        $this->detail->RetailerId = $retailerid; 
    } 
} 

class exec0Request { 

    var $arguments; 

    function __construct($arguments) 
    { 
     $this->arguments = $arguments; 
    } 
} 


$order = new CbOrderProduct(); 
$order->setheader('123','123abc'); 
$order->setdetail('9789084999912','1988763767','K Koning','CR','12345'); 
$request = new exec0Request($order); 
$client = new SoapClient("https://tst.eboekhuis.nl/cbwebs/CBWSCallEngine?WSDL"); 
$result = $client->exec(new SoapParam($request, "exec0Request")); 
0
Finally I have solved this issue.. :) 
Below code will definitely work. 

$xml = '<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<soapenv:Body> 
<exec xmlns="CBWSCallEngine" 
soapenv:encodingStyle="http://xml.apache.org/xml-soap/literalxml"> 
<arguments> 
<CbOrderProduct xmlns="http://www.cbonline.nl/xsd"> 
<Header> 
<EndpointNm>*********</EndpointNm> 
<Certificaat>***********</Certificaat> 
</Header> 
<Detail> 
<EAN>9789084999967</EAN> 
<OrderReference>1988763767</OrderReference> 
<ReadingMethods>D</ReadingMethods> 
<RetailerId>12345</RetailerId> 
</Detail> 
</CbOrderProduct> 
</arguments> 
</exec> 
</soapenv:Body> 
</soapenv:Envelope>'; 

$sUrl = 'https://tst.eboekhuis.nl/cbwebs/CBWSCallEngine?WSDL'; 

// set parameters 

$ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL,$sUrl); 
    curl_setopt($ch, CURLOPT_VERBOSE, 1); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); 
    $sOutput = curl_exec($ch); 
    curl_close($ch); 
    echo "<pre>"; 
    print_r($sOutput);