问题
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?
回答1:
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.
回答2:
I am only passingly-familiar with PHP, and have never used the NuSOAP package at all. However, a SOAP message's size should only be limited by the transport medium. In the case of HTTP, it should be pretty much unbounded (the limitation of 16384 bytes in form POST requests isn't due to SOAP, it's from browser limitations (which may actually not exist anymore, but I don't know for certain)).
I would recommend finding a contact address for the authors/maintainers of NuSOAP and ask them directly. Unless there's something in the WSDL (and I don't recall anything in the WSDL spec that would limit a whole message-body-size... individual parameters (via XML Schema facets), but not the overall body), then the limitation would seem to be in the toolkit.
回答3:
On a production box we use the PHP 5.2.5 built-in Soap-functions as server and NuSoap on PHP 4 and have successfully transferred messages larger than 1 MB.
I don't think that there is a limitation in either product, but you should check your settings in php.ini for
max_input_time (defaults to 60)
This is the time each script is allowed to parse input. If the time is up before parsing is complete, the script will not even run.
A sidenote: If possible, I suggest migrating to the SoapClient/SoapServer PHP extension classes. NuSoap has proved itself not very reliable in heavy-load situations, especially when it comes to the cache. Sometimes we saw NuSoap simply "forgetting" wsdl definitions and working in none-wsdl-mode. Weird...
回答4:
You haven't said if you're sending or receiving SOAP messages. If you're sending, I'd be checking to see that NuSOAP is sending via POST rather than GET (you'll probably have to dig into the code to see; I've found the documentation sparse). If you're receiving, check your PHP.INI settings for things like memory and data size. Actually, check your memory limits, anyway -- NuSOAP is quite a memory hog, IIRC.
回答5:
I think message size will be limited rather by a PHP memory limit, than by some hardcoded value. At least I could send a 6.5MB string without any problems. When I tried to send a 8MB string I got an out of memory exception inside nusoap.php (my server has 64MB limit for PHP).
来源:https://stackoverflow.com/questions/231358/how-is-the-max-size-of-a-soap-message-determined