dpzr52746 2014-03-12 17:28
浏览 118

使用PHP SoapClient的SOAP请求无法正常工作

I am new to SOAP. I am working with a web service organization who needs the following request:

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>

But I cant get this to work. I have tried the following:

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);
    }

What am i missing? please help. I am getting this error: Fatal error: Uncaught SoapFault exception: [q0:Security] Security requirements are not satisfied because the security header is not present in the incoming message.

  • 写回答

1条回答 默认 最新

  • dox19458 2018-05-30 09:39
    关注

    This is a bit late response but maybe it will help someone.

    You need to include security header into request.

    Username and Password are agency Id and password.

    Here is example:

    <?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>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀