php soap客户端请求

时间:2015-08-10 06:38:21

标签: php soap wsdl

如何将PHP SOAP请求发送到.NET Web服务,我已经尝试过soapclient();上课但有些不对劲.....任何身体请帮助我。

POST /KH/TestKH/WebServices.asmx HTTP/1.1
Host: www.host.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/SearchMethod"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SearchMethod xmlns="http://tempuri.org/">
  <_hap>string</_hap>
  <_hapType>string</_hapType>
  <UserID>string</UserID>
  <Password>string</Password>
  <Origin>string</Origin>
  <Destination>string</Destination>
  <FromDate>string</FromDate>
  <ToDate>string</ToDate>
  <Class>string</Class>
  <Airlines>string</Airlines>
  <Adults>int</Adults>
  <Childs>int</Childs>
  <Infants>int</Infants>
  <isReturn>boolean</isReturn>
  <CompanyCode>string</CompanyCode>
  <sessionId>string</sessionId>
</SearchMethod>
</soap:Body>
</soap:Envelope>

我们的代码:

$options["soap_version"]=SOAP_1_1;
$options["trace"]=true;
$options["exceptions"]=0;
$options["UserID"]="xxxxx";
$options["Password"]="xxxxx";
$client = new SoapClient("http://www.HOST.com/KH/TestKH/WebServices.asmx?WSDL",$options);



    //var_dump($client->__getTypes());
    $parameters= new stdClass();
    $parameters->_hap="xxxxxxxxx";
    $parameters->_hapType="TEST";
    //$parameters->UserID="";
    //$parameters->Password="";
    $parameters->Origin="AUS";
    $parameters->Destination="LHR";
    $parameters->FromDate="01/01/2016";
    $parameters->ToDate="27/02/2016";
    $parameters->Class="X";
    $parameters->Airlines="";
    $parameters->Adults="1";
    $parameters->Childs="0";
    $parameters->Infants="0";
    $parameters->isReturn=true;
    $parameters->CompanyCode="xxxxx";
    $parameters->sessionId="xxxxxx";

    $result=$client->SearchMethod($parameters);
    var_dump($result);
    var_dump($client->__getLastRequest());
    $status=$result->SearchMethodResult;
    var_dump($status);
}
catch (Exception $e){
    $e -> getMessage();
    var_dump($e);
}

我们的请求流程但不知道这些代码有什么问题,因为显示服务器端错误&#34;发生了未知错误!&#34;

0 个答案:

没有答案