PHP - SoapServer->Handle() 之后的 SOAP-ENV:ClientBad 请求 - 帮助

发布于 2024-11-10 17:22:03 字数 990 浏览 4 评论 0原文

我有一个 PHP Web 服务,它已经运行了很长一段时间,但在很长一段时间内它突然停止工作了,我就是无法让它再次工作。

我得到了一些 php 页面,其中我所做的就是定义一个带有函数的类,最后我创建了 SoapServer。

它看起来像这样 -

class MyClassWS
{
     function .....
     function ....
}
ini_set("soap.wsdl_cache_enabled", "0");
    error_log("Server after ini_set");
    $soapserver = new SoapServer("MyWSDL.wsdl");

    error_log("Server after new SoapServer");
$soapserver->setClass("MyClassWS");
    error_log("Server after setClass");
    //error_log(print_r($soapserver->getFunctions()));

    try
    {
        $soapserver->handle();
    }
    catch(Exception $ex)
    {
        error_log("Exception!".$ex->getMessage());

    }
error_log("Finished Handling",0);

就在 $soapserver->handle(); 之后代码终止,我在网页上得到模糊的“SOAP-ENV:ClientBad Request”结果。

当我从索引页“require_once”此页面时会发生这种情况,因此我可以从索引页调用此类中定义的函数。

我的猜测是,也许我对 WSDL 的摆弄太多了,不知怎的,它搞砸了我的 WebService,但我试图找出它出了什么问题,但无法找到任何东西。特别是因为这个令人讨厌的模糊错误消息,这并没有真正的帮助。

谢谢!

I got a PHP web service that had been running great for a long time, but somewhere a long the way it some how stopped working, and I just can't get it to work again.

I got some php page in which all I do is define a class with functions, and in the end of it I create the SoapServer.

It looks like this -

class MyClassWS
{
     function .....
     function ....
}
ini_set("soap.wsdl_cache_enabled", "0");
    error_log("Server after ini_set");
    $soapserver = new SoapServer("MyWSDL.wsdl");

    error_log("Server after new SoapServer");
$soapserver->setClass("MyClassWS");
    error_log("Server after setClass");
    //error_log(print_r($soapserver->getFunctions()));

    try
    {
        $soapserver->handle();
    }
    catch(Exception $ex)
    {
        error_log("Exception!".$ex->getMessage());

    }
error_log("Finished Handling",0);

Right after the $soapserver->handle(); the code terminates, and I get a vague "SOAP-ENV:ClientBad Request" result on my web page.

This happens when I "require_once" this page, from my index page, so I could call functions that are defined in this class, from my index page.

My guess is that maybe I've been fiddling too much with my WSDL and somehow it screwed up my while WebService, but I tried looking on what's wrong with it, but couldn't get onto anything. Especially because of this annoying vague error message, that doesn't really help.

Thanks!

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

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

发布评论

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

评论(1

∞琼窗梦回ˉ 2024-11-17 17:22:03

我想我通过将包含 SoapServer 的 WebService 类分成 2 个不同的类来很好地解决了这个问题。

一个仅包含具有函数的类,另一个包含 WebServer 并且仅包含对该类的引用。

这样我就可以导入带有函数的类,而无需导入 SoapServer 并触发 handle() 函数。

I think I nicely fixed it by separating the WebService class that included the SoapServer into 2 different classes.

One that included only the class with the functions, and another that included the WebServer and only had a reference to the class.

This way I can import the class with the functions without also importing the SoapServer and triggering the handle() function.

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