在出现肥皂故障异常后,如何查看来自 Zend_Soap_Client->getLastRequest() 的最后一个请求?

发布于 2024-12-17 23:18:14 字数 354 浏览 2 评论 0原文

我正在使用 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 技术交流群。

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

发布评论

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

评论(2

末骤雨初歇 2024-12-24 23:18:14

你的问题实际上与你想象的略有不同。 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() returns NULL 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 return NULL.

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

勿忘初心 2024-12-24 23:18:14

顺便说

    try {
        $client = new Zend_Soap_CLient();
        $client->doSomething($params);

    } catch(SoapFault $f) {
        echo $f->getTraceAsString();
    }

一句怎么样。 Zend_Soap_Client->getLastRequest() 包装 SoapClient::__getLastRequest();

How about

    try {
        $client = new Zend_Soap_CLient();
        $client->doSomething($params);

    } catch(SoapFault $f) {
        echo $f->getTraceAsString();
    }

Btw. Zend_Soap_Client->getLastRequest() wraps SoapClient::__getLastRequest();

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