簡體   English   中英

使用php中的soap發送xml請求到另一個Web服務器

[英]send an xml request to a another web server using soap in php

我需要使用SOAP將XML請求發送到另一個Web服務器。

我需要將請求發送到:

http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl

我的代碼在

http://mydomain/demo1/test.php

我是SOAP的新手。 看我的代碼:

$test ="<?xml version=\'1.0\' encoding=\'UTF-8\'?><soapenv:Envelope xmlns:soapenv=\'http://schemas.xmlsoap.org/soap/envelope/\' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\'> <soapenv:Body>  <getAvailability xmlns=\'http://avail.flight.arzoo.com\'>   <in0 xmlns=\'\'>  &lt;Request&gt;&lt;Origin&gt;BLR&lt;/Origin&gt;&lt;Destination&gt;DEL&lt;/Destination&gt;&lt;DepartDate&gt;2012-08-27&lt;/DepartDate&gt;&lt;ReturnDate&gt;2012-08-28&lt;/ReturnDate&gt;&lt;AdultPax&gt;1&lt;/AdultPax&gt;&lt;ChildPax&gt;0&lt;/ChildPax&gt;&lt;InfantPax&gt;0&lt;/InfantPax&gt;&lt;Currency&gt;INR&lt;/Currency&gt;&lt;Clientid&gt;My Id&lt;/Clientid&gt;&lt;Clientpassword&gt; my Password&lt;/Clientpassword&gt;&lt;ArzooFWS1.1&lt;/Clienttype&gt;&lt;Preferredclass&gt;E&lt;/Preferredclass&gt;&lt;mode&gt;ONE&lt;/mode&gt;&lt;PreferredAirline&gt;AI,G8,IC,6E,9W,S2,IT,9H,I7,SG&lt;/PreferredAirline&gt;&lt;/Request&gt;    </in0>  </getAvailability></soapenv:Body></soapenv:Envelope>";
$location_URL = "http://mydomain/demo1/test.php";
$action_URL = "http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl";

$client = new SoapClient(null, array(
    'location' => $location_URL,
    'uri'      => "",
    'trace'    => 1,
));
try{
    $order_return = $client->__doRequest($test,$location_URL,$action_URL,1);
    //Get response from here
    print_r($order_return);
    $return = $client->__getLastResponse();  
    echo $return;
} catch (SoapFault $exception) {
    var_dump(get_class($exception));
    var_dump($exception);

但是什么也沒發生。 我需要得到回應。 請問有人知道嗎?

嘗試更改:

$action_URL = "http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl";

$action_URL = "http://59.162.33.102/ArzooWS/services/DOMFlightAvailability";

wsdl鏈接僅提供肥皂消息格式的准則。 您需要將請求發送到服務端點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM