我遇到了使用 SOAP 的 API 的问题。我的客户端是用 PHP 编写的,并产生以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://webportal.gb.co.uk/GBPortal" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:CreateAuthenticatedSession xsi:type="ns1:CreateAuthenticatedSession">
<szUsername xsi:type="xsd:string">...</szUsername>
<szPassword xsi:type="xsd:string">...</szPassword>
</ns1:CreateAuthenticatedSession>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
文档中的参考 XML 是:
<?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>
<CreateAuthenticatedSession xmlns="http://webportal.gb.co.uk/GBPortal">
<szUsername>string</szUsername>
<szPassword>string</szPassword>
</CreateAuthenticatedSession>
</soap:Body>
</soap:Envelope>
据我所知,在功能上是相同的。
我是否遗漏了任何会导致 API 拒绝 XML 的差异?宁愿不必通过使用字符串连接来生成 XML。
编辑:如果没有功能差异,请留下答案。