PHP SoapClient 构造函数非常慢
我正在尝试对 SOAP API 进行一些测试,但执行速度非常慢。我做了一些挖掘,发现 SoapClient 构造函数需要永远执行。我还尝试使用代理来查看它是否是由此产生的http查询,但是这个查询执行得相对较快..在查询之后,它徘徊了大约30秒。
以下是供参考的 kcachegrind 屏幕截图:
这是 Charles 代理中的 WSDL 查询:
几个月前也报告了同样的问题:
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:
And here's the WSDL query in 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用多个用户吗?我在同一行代码上遇到了 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/