小编Jon*_*onP的帖子

处理SOAP响应

我正在尝试从First Data的全局网关处理SOAP响应.我之前使用过SoapClient,但没有wsdl - 该公司表示他们不提供.

我已经尝试了各种其他方法,例如基于此处和PHP手册中的示例的SimpleXMLElement,但我无法获得任何工作.我怀疑命名空间是我的问题的一部分.任何人都可以建议一种方法或指向一个类似的例子 - 我的谷歌努力迄今为止毫无结果.

使用PHP 5.

部分SOAP响应(在它被剥离之前的所有HTML标题内容)看起来像这样:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<fdggwsapi:FDGGWSApiOrderResponse xmlns:fdggwsapi="http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi">

<fdggwsapi:CommercialServiceProvider/>

<fdggwsapi:TransactionTime>Thu Nov 29 17:03:18 2012</fdggwsapi:TransactionTime>

<fdggwsapi:TransactionID/>

<fdggwsapi:ProcessorReferenceNumber/>

<fdggwsapi:ProcessorResponseMessage/>

<fdggwsapi:ErrorMessage>SGS-005005: Duplicate transaction.</fdggwsapi:ErrorMessage>

<fdggwsapi:OrderId>A-e833606a-5197-45d6-b990-81e52df41274</fdggwsapi:OrderId>
...

<snip>
Run Code Online (Sandbox Code Playgroud)

我还需要能够确定是否发出SOAP错误信号.XML的内容如下所示:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:FaultX>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring xml:lang="en">MerchantException</faultstring>
<detail>
cvc-pattern-valid: Value '9999185.00' is not facet-valid with respect to pattern '([1-9]([0-9]{0,3}))?[0-9](\.[0-9]{1,2})?' for type '#AnonType_ChargeTotalAmount'.
cvc-type.3.1.3: The value '9999185.00' of element 'v1:ChargeTotal' is not valid.
</detail>
</SOAP-ENV:FaultX>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

使用Code先生的答案,我能够从非故障响应中检索数据.但是我需要确定我正在处理什么类型的数据包并从这两种类型中提取数据.只要他们提供wsdl就会容易得多!

php soap

5
推荐指数
1
解决办法
1151
查看次数

标签 统计

php ×1

soap ×1