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 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突