我需要使用SOAP向另一个Web服务器发送XML请求。
我需要将请求发送到:
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=\'\'> <Request><Origin>BLR</Origin><Destination>DEL</Destination><DepartDate>2012-08-27</DepartDate><ReturnDate>2012-08-28</ReturnDate><AdultPax>1</AdultPax><ChildPax>0</ChildPax><InfantPax>0</InfantPax><Currency>INR</Currency><Clientid>My Id</Clientid><Clientpassword> my Password</Clientpassword><ArzooFWS1.1</Clienttype><Preferredclass>E</Preferredclass><mode>ONE</mode><PreferredAirline>AI,G8,IC,6E,9W,S2,IT,9H,I7,SG</PreferredAirline></Request> </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);
但没有任何反应。我需要得到答复。 请问有谁知道吗?
答案 0 :(得分:0)
尝试更改:
$action_URL = "http://59.162.33.102/ArzooWS/services/DOMFlightAvailability?wsdl";
到
$action_URL = "http://59.162.33.102/ArzooWS/services/DOMFlightAvailability";
wsdl链接仅提供soap消息格式的指南。您需要将请求发送到您的服务端点。