在出现肥皂故障异常后,如何查看来自 Zend_Soap_Client->getLastRequest() 的最后一个请求?
我正在使用 Zend_Soap_Client 来调用 Web 服务。我收到一个错误异常,我怀疑是因为我没有随请求发送某些内容:
致命错误:未捕获的 SoapFault 异常:[发件人] SOAP-ERROR: 编码:对象没有“V24Flag”属性
因为它抛出异常我想尝试查看发送的实际请求是什么,但是由于异常,我无法使用 Zend_Soap_Client->getLastRequest() 来获取请求(它返回空)。看看 Zend_Soap_Client->getLastRequest() 它是soapClient->__soapCall()的一个薄包装器,我不知道如何深入挖掘。
I am using a Zend_Soap_Client to call a web service. I am getting an exception from the error which I suspect is down to me not sending something along with the request:
Fatal error: Uncaught SoapFault exception: [Sender] SOAP-ERROR:
Encoding: object hasn't 'V24Flag' propert
Because it throws an exception I want to try view what is the actual request being sent, however because of the exception, I can not use Zend_Soap_Client->getLastRequest() to get the request (it returns null). Looking at the Zend_Soap_Client->getLastRequest() its a thin wrapper for soapClient->__soapCall() which I'm not sure how to dig deeper from.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题实际上与你想象的略有不同。
Zend_Soap_Client::getLastRequest()
为您返回NULL
的原因是没有发出任何请求:在内部比较请求的阶段抛出错误您正在使用的 WSDL。所以该方法返回NULL
是完全正确的。至于如何为您的 SOAP 调用形成参数,以便不会抛出此错误,我现在无法提供更大的帮助(我希望这部分取决于您正在集成的服务),但有一个用户级答案在 php.net 页面上
SoapClient::__soapCall()
这可能会为您指明一个富有成效的方向。从本质上讲,有些人似乎通过将数组结构深度转换为stdClass
对象而取得了一些进展。这似乎并不是整个故事(这不是我目前正在调查的问题),实际上这可能取决于 PHP 中的错误,但我希望它能帮助您找到答案。Your problem is actually slightly different to what you think it is. The reason
Zend_Soap_Client::getLastRequest()
returnsNULL
for you is that no request was ever made: the error is being thrown at the stage where the request internally is being compared against the WSDL you are using. So the method is perfectly correct to returnNULL
.As to how to form the parameter for your SOAP call so this error isn't thrown, I can't be of much greater help right now (I expect it depends partly on the services you are integrating with), but there's a userland answer on the php.net page for
SoapClient::__soapCall()
which may point you in a fruitful direction. Essentially, some people seem to have got somewhere by doing a deep conversion of an array structure intostdClass
objects. That doesn't seem to be the whole story (it isn't for the issue I'm currently investigating), and indeed this may be down to a bug in PHP, but I hope it helps you towards an answer.顺便说
一句怎么样。 Zend_Soap_Client->getLastRequest() 包装 SoapClient::__getLastRequest();
How about
Btw. Zend_Soap_Client->getLastRequest() wraps SoapClient::__getLastRequest();