SOAP 消息的最大大小是如何确定的?

发布于 2024-07-08 08:17:15 字数 108 浏览 8 评论 0原文

我在 PHP 5.2.6 上使用 NuSOAP,发现最大消息大小仅为 1000 字节(这使得执行任何有意义的操作变得困难)。 这是在端点的 WSDL 中设置的还是我可以在 NuSOAP 中配置的内容?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

娜些时光,永不杰束 2024-07-15 08:17:15

关于“1000 字节限制”的 FUD...我查找了 nusoap_client 源代码,发现该限制仅对调试输出有效。

这意味着所有数据都会被处理并传递到 Web 服务(无论其大小),但调试日志中仅显示前 1000 个字节(或更准确地说:字符)。

代码如下:

$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);

正如您可以清楚地看到的,getHTTPBody() 调用使用整个 $soapmsg,并且只有调试输出仅限于前 1000 个字符。 如果您想更改此设置,只需更改 substr() 调用以满足您的需求,或者只需将其替换为 $soapmsg (这样所有内容都会显示在调试中)输出也)。

这应该与实际发送的数据的任何实际限制完全无关。 当然,可能还有其他因素实际上限制了您可以发送的内容的大小(例如,为 PHP 脚本设置的 RAM 限制、HTTP 实现的限制或耗尽可用虚拟内存),但请想当然地认为没有例如,您可以使用 NuSOAP 发送的数据有“1000 字节限制”。

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.

执笏见 2024-07-15 08:17:15

我只是对 PHP 略知一二,根本没有使用过 NuSOAP 包。 然而,SOAP 消息的大小应该仅受传输介质的限制。 在 HTTP 的情况下,它应该是几乎没有限制的(表单 POST 请求中 16384 字节的限制不是由于 SOAP,而是来自浏览器限制(实际上可能不再存在,但我不确定) )。

我建议找到 NuSOAP 作者/维护者的联系地址并直接询问他们。 除非 WSDL 中存在某些内容(而且我不记得 WSDL 规范中存在任何会限制整个消息正文大小的内容...各个参数(通过 XML 模式方面),但不是整个正文),那么限制似乎在工具包中。

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.

戴着白色围巾的女孩 2024-07-15 08:17:15

在生产环境中,我们使用 PHP 5.2.5 内置 Soap 函数作为服务器,并使用 PHP 4 上的 NuSoap,并成功传输了大于 1 MB 的消息。

我认为这两种产品都没有限制,但您应该检查 php.ini 中的设置,以了解

max_input_time        (defaults to 60)

允许每个脚本解析输入的时间。 如果解析完成之前时间已到,脚本甚至不会运行。

旁注:如果可能,我建议迁移到 SoapClient/SoapServer PHP 扩展类。 NuSoap 已证明自己在重负载情况下不太可靠,尤其是在缓存方面。 有时我们看到 NuSoap 只是“忘记”wsdl 定义并在非 wsdl 模式下工作。 诡异的...

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

ぇ气 2024-07-15 08:17:15

您还没有说明您是否正在发送或接收 SOAP 消息。 如果您要发送,我会检查 NuSOAP 是否通过 POST 而不是 GET 发送(您可能需要深入研究代码才能看到;我发现文档很少)。 如果您正在接收,请检查您的 PHP.INI 设置以了解内存和数据大小等信息。 实际上,无论如何,请检查您的内存限制 - NuSOAP 非常消耗内存,IIRC。

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.

七禾 2024-07-15 08:17:15

我认为消息大小将受到 PHP 内存限制的限制,而不是某些硬编码值的限制。 至少我可以毫无问题地发送 6.5MB 的字符串。 当我尝试发送 8MB 字符串时,nusoap.php 出现内存不足异常(我的服务器对 PHP 有 64MB 限制)。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文