问题描述
有这样的野兽吗? PHP附带的简单的 SOAP客户端不能理解多部分消息.预先感谢.
Is there such a beastie? The simple SOAP client that ships with PHP does not understand multi-part messages. Thanks in advance.
推荐答案
原生PHP SoapClient
类不支持多部分消息(并且在所有WS- *问题中都受到严格限制),我也认为PHP编写的库都不 NuSOAP 或 Zend_Soap 可以处理这种SOAP消息.
The native PHP SoapClient
class does not support multipart messages (and is strongly limited in all WS-* matters) and I also I think that neither the PHP written libraries NuSOAP nor Zend_Soap can deal with this sort of SOAP messages.
我可以想到两种解决方案:
I can think of two solutions:
-
扩展
SoapClient
类并覆盖SoapClient::__doRequest()
方法以获取实际的响应字符串,然后您可以根据自己的想法进行解析.
extend the
SoapClient
class and overwrite theSoapClient::__doRequest()
method to get hold of the actual response string which you can then parse at your whim.
class MySoapClient extends SoapClient
{
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
// parse $response, extract the multipart messages and so on
}
}
这可能有些棘手-但值得一试.
This could be somewhat tricky though - but worth a try.
为PHP使用更复杂的SOAP客户端库.我想到的第一个也是唯一一个是 WSO2 WSF/PHP ,它具有SOAP MTOM,WS -寻址,WS-Security,WS-SecurityPolicy,WS-Secure Conversation和WS-ReliableMessaging,而必须安装本机PHP扩展.
use a more sophisticated SOAP client library for PHP. The first and only one that comes into my mind is WSO2 WSF/PHP which features SOAP MTOM, WS-Addressing, WS-Security, WS-SecurityPolicy, WS-Secure Conversation and WS-ReliableMessaging at the cost of having to install a native PHP extension.
这篇关于能理解多部分消息的PHP SOAP客户端吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!