我正在尝试整合netForum。它需要一些SOAP请求。以下是SOAP 1.1请求和响应的示例,但我不知道如何在php中实现它。
请求:
POST /xweb/netFORUMXMLONDemand.asmx HTTP/1.1
Host: nftpsandbox.avectra.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.avectra.com/OnDemand/2005/NewIndividualInformation"
<?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>
<AuthorizationToken xmlns="http://www.avectra.com/OnDemand/2005/">
<Token>string</Token>
</AuthorizationToken>
</soap:Header>
<soap:Body>
<NewIndividualInformation xmlns="http://www.avectra.com/OnDemand/2005/">
<oNode>xml</oNode>
</NewIndividualInformation>
</soap:Body>
</soap:Envelope>
回应 -
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?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>
<AuthorizationToken xmlns="http://www.avectra.com/OnDemand/2005/">
<Token>string</Token>
</AuthorizationToken>
</soap:Header>
<soap:Body>
<NewIndividualInformationResponse xmlns="http://www.avectra.com/OnDemand/2005/">
<NewIndividualInformationResult>xml</NewIndividualInformationResult>
</NewIndividualInformationResponse>
</soap:Body>
</soap:Envelope>
答案 0 :(得分:1)
PHP通过SOAP扩展(在最近的配置中激活)内置了对此的支持。背后的背景可以通过http://php.net/manual/en/book.soap.php获得。 SOAP允许您执行远程调用,就像您在自己的对象上执行它们一样,这样您可能与您发布的 raw 数据几乎没有关系。
基本上PHP的SOAP扩展的功能分为SoapClient
类和SoapServer
类。前者将是你需要的那个。请查看http://www.php.net/manual/en/soapclient.dorequest.php并查看API文档,了解您可以提出的请求。