douzhao1912 2013-06-11 11:33
浏览 120
已采纳

使用PHP连接到示例SOAP 1.1

Hello i need to connect to SOAP web services with password, username and SourceId in php. the SOAP request is:

POST /webservices/AgentOnlineReservation.asmx HTTP/1.1
Host: 54.228.189.53
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetHotelsData"

<?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>
    <GetHotelsData xmlns="http://tempuri.org/">
      <SourceId>string</SourceId>
      <UserName>string</UserName>
      <Password>string</Password>
    </GetHotelsData>
  </soap:Body>
</soap:Envelope> 

Please help me.

  • 写回答

1条回答 默认 最新

  • doushao8421 2013-06-11 11:39
    关注

    Use the native SoapClient library:

    $client = new SoapClient('linkhere.com/AgentOnlineReservation.asmx?wsdl');
    
    $response = $client->GetHotelsData(array(
        'SourceId' => '...',
        'UserName' => '...',
        'Password' => '...'
    ));
    
    print_r($response);
    

    The link passed in the SoapClient call is the WSDL (Web Service Description Language) file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别