Search code examples
phpsoapwsdlnusoap

How is the max size of a SOAP message determined?


I'm using NuSOAP on PHP 5.2.6 and I'm seeing that the max message size is only 1000 bytes (which makes it tough to do anything meaningful). Is this set in the endpoint's WSDL or is this something I can configure in NuSOAP?


Solution

  • Regarding the FUD about a "1000 bytes limit"... I looked up the nusoap_client sourcecode and found that the limit is only effective for debug output.

    This means all data is processed and passed on to the webservice (regardless of its size), but only the first 1000 bytes (or more precisely: characters) are shown in the debug log.

    Here's the code:

    $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
    
    // send
    $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
    

    As you can clearly see, the getHTTPBody() call uses the whole $soapmsg, and only the debug output is limited to the first 1000 characters. If you'd like to change this, just change the substr() call to fit your needs, or simply replace it by $soapmsg (so everything is shown in the debug output, too).

    This should have absolutely nothing to do with any real limit on the data actually sent. There could of course be other factors actually limiting the size of what you can send (e. g. the RAM limit set for your PHP script, limitations of your HTTP implementation, or running out of available virtual memory), but take it for granted there is no such thing as a "1000 bytes limit" for the data you can send with NuSOAP.