olefevre olefevre - 1 year ago 202
PHP Question

PHP SOAP client that understands multi-part messages?

Is there such a beastie? The simple SOAP client that ships with PHP does not understand multi-part messages. Thanks in advance.

Answer Source

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:

  • extend the SoapClient class and overwrite the SoapClient::__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.

  • 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download