PHP SoapClient 构造函数非常慢

发布于 2024-12-06 03:22:09 字数 1295 浏览 2 评论 0原文

我正在尝试对 SOAP API 进行一些测试,但执行速度非常慢。我做了一些挖掘,发现 SoapClient 构造函数需要永远执行。我还尝试使用代理来查看它是否是由此产生的http查询,但是这个查询执行得相对较快..在查询之后,它徘徊了大约30秒。

以下是供参考的 kcachegrind 屏幕截图:

kcachegrind

这是 Charles 代理中的 WSDL 查询:

charles proxy

几个月前也报告了同样的问题:

PHP:SoapClient 构造函数非常慢(需要 3 分钟)

但他没有得到答案。

任何建议将不胜感激。

编辑:

SoapClient 启动的代码部分(这是 NetSuite PHP 工具包的一部分)

        $this->client = new SoapClient( $host . "/wsdl/v" . $endpoint . "_0/netsuite.wsdl",

                                    array(  "location"              => $host . "/services/NetSuitePort_" . $endpoint,

                                            "trace"                 => 1,

                                            "connection_timeout"    => 5,

                                            "typemap"               => $typemap,

                                            "user_agent"            => "PHP-SOAP/" . phpversion() . " + NetSuite PHP Toolkit " . $version

                                    )

    );

I'm trying to do some tests on a SOAP API and am experiencing extremely slow execution times. I've done some digging and found that it's the SoapClient constructor that takes forever to execute. I also tried using a proxy for it to see if it's the http query resulting from it, but this query is executed relatively fast.. it's after the query that it lingers for about 30 seconds.

Here's a kcachegrind screenshot for reference:

kcachegrind

And here's the WSDL query in Charles Proxy:

charles proxy

This same problem has also been reported a couple of months ago here:

PHP: SoapClient constructor is very slow (takes 3 minutes)

But he did not get an answer.

Any suggestions would be much appreciated.

Edit:

The code portion where the SoapClient is initiated (this is part of the NetSuite PHP toolkit)

        $this->client = new SoapClient( $host . "/wsdl/v" . $endpoint . "_0/netsuite.wsdl",

                                    array(  "location"              => $host . "/services/NetSuitePort_" . $endpoint,

                                            "trace"                 => 1,

                                            "connection_timeout"    => 5,

                                            "typemap"               => $typemap,

                                            "user_agent"            => "PHP-SOAP/" . phpversion() . " + NetSuite PHP Toolkit " . $version

                                    )

    );

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

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

发布评论

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

评论(1

泪是无色的血 2024-12-13 03:22:09

您使用多个用户吗?我在同一行代码上遇到了 3-20 分钟的延迟,结果证明这与多个用户导致获取 wsdl 的多个副本有关。
http://www.ozonesolutions.com/programming/2011/05/ nsclient-登录时间/

Are you using multiple users? I was getting 3-20 minute lags on the same line of code which turned out to be related to multiple users causing multiple copies of the wsdl to be fetched.
http://www.ozonesolutions.com/programming/2011/05/nsclient-login-time/

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