我是SOAP的新手。我正在与一个web服务组织合作,需要以下请求:
POST /bookingapi.asmx HTTP/1.1
Host: bookingapitest.globusfamily.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://globusfamily.com/api/booking/ws/internal/GVI_DepartureInfo"
<?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>
<GVI_DepartureInfo xmlns="http://globusfamily.com/api/booking/ws/internal">
<GVI_DepartureInfoRequest VendorId="string" VendorPassword="string" xmlns="http://globusfamily.com/api/booking/departureinforequest">
<Brand>string</Brand>
<TourCode>string</TourCode>
<DepartureCode>string</DepartureCode>
</GVI_DepartureInfoRequest>
</GVI_DepartureInfo>
</soap:Body>
</soap:Envelope>
但是我不能让这个工作。我尝试了以下操作:
function test_booking_globus_soap_connect() {
$serviceWsdl = 'https://bookingapitest.globusfamily.com/bookingapi.asmx?WSDL';
$serviceParams = array(
'login' => "logind",
'password' => "pw"
);
$client = new SoapClient($serviceWsdl, $serviceParams);
$data['Brand'] = "All";
$data['TourCode'] = "QBE";
$data['DepartureCode'] = "800040321";
$data['VendorId'] = "test";
$data['VendorPassword'] = "test";
$results = $client->GVI_DepartureInfo($data);
}
我错过了什么?请帮助。我得到这个错误:致命错误:Uncaught SoapFault exception: [q0:Security]安全要求不满足,因为传入消息中没有安全头。
这是一个有点晚的回复,但也许它会帮助别人。
你需要在请求中包含安全头。
"用户名"one_answers"密码"分别为机构号和密码。
示例:
<?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:Header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken>
<Username>string</Username>
<Password>string</Password>
</UsernameToken>
</Security>
</soap:Header>
<soap:Body>
<GVI_DepartureInfo xmlns="http://globusfamily.com/api/booking/ws/internal">
<GVI_DepartureInfoRequest VendorId="string" VendorPassword="string" xmlns="http://globusfamily.com/api/booking/departureinforequest">
<Brand>string</Brand>
<TourCode>string</TourCode>
<DepartureCode>string</DepartureCode>
</GVI_DepartureInfoRequest>
</GVI_DepartureInfo>
</soap:Body>
</soap:Envelope>