PHP SoapClient构造函数非常慢 [英] PHP SoapClient Constructor extremely slow

查看:142
本文介绍了PHP SoapClient构造函数非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对SOAP API进行一些测试,并且正在经历极其缓慢的执行时间.我做了一些挖掘,发现它是SoapClient构造函数,需要永远执行.我还尝试使用代理来查看它是否是由此产生的http查询,但是此查询的执行速度相对较快.在查询之后,它徘徊了约30秒钟.

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.

下面是一个供参考的kcachegrind屏幕截图:

Here's a kcachegrind screenshot for reference:

这是Charles Proxy中的WSDL查询:

And here's the WSDL query in Charles Proxy:

几个月前,这里也曾报道过同样的问题:

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

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

但是他没有得到答案.

任何建议将不胜感激.

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

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

                                    )

    );

推荐答案

您是否正在使用多个用户?我在同一行代码上滞后3至20分钟,结果证明与多个用户有关,导致提取了多个wsdl副本. http://www.ozonesolutions.com/programming/2011/05/nsclient-login-time/

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/

这篇关于PHP SoapClient构造函数非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆