dongyun51582 2015-08-11 16:05
浏览 35
已采纳

如何在PHP文件中创建SOAP请求? [重复]

This question already has an answer here:

I want to make the following SOAP request in a PHP file, but I'm not sure how to implement it. Could someone explain how I would use this?

Also, how can I print out the result of the request stored in "LoginSuccess"

POST /soap/V200611.ASMX HTTP/1.1
Host: api.cvent.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Login xmlns="http://api.cvent.com/2006-11">
      <AccountNumber>string</AccountNumber>
      <UserName>string</UserName>
      <Password>string</Password>
    </Login>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <LoginResponse xmlns="http://api.cvent.com/2006-11">
      <LoginResult LoginSuccess="boolean" ServerURL="string" CventSessionHeader="string" ErrorMessage="string" xmlns="http://schemas.cvent.com/api/2006-11" />
    </LoginResponse>
  </soap12:Body>
</soap12:Envelope>
</div>
  • 写回答

1条回答 默认 最新

  • doutun9179 2015-08-11 16:07
    关注

    Check the manual for http://php.net/manual/en/soapclient.dorequest.php:

    public string SoapClient::__doRequest ( string $request , string $location , string $action , int $version [, int $one_way = 0 ] ) performs SOAP request over HTTP.

    Parameters:

    request The XML SOAP request.

    location The URL to request.

    action The SOAP action.

    version The SOAP version.

    one_way If one_way is set to 1, this method returns nothing. Use this where a response is not expected.

    Return:

    The XML SOAP response.

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

报告相同问题?

悬赏问题

  • ¥15 驱动学习 环境部署中的问题
  • ¥15 【急】在线问答CNC雕刻机的电子电路与编程
  • ¥60 在mc68335芯片上移植ucos ii 的成功工程文件
  • ¥15 笔记本外接显示器正常,但是笔记本屏幕黑屏
  • ¥15 Python pandas
  • ¥15 蓝牙硬件,可以用哪几种方法控制手机点击和滑动
  • ¥15 生物医学数据分析。基础课程就v经常唱课程舅成牛逼
  • ¥15 云环境云开发云函数对接微信商户中的分账功能
  • ¥15 空间转录组CRAD遇到问题
  • ¥20 materialstudio计算氢键脚本问题