在 PHP5 中禁用本机 Soap 类并使用 nuSoap?

发布于 2024-08-24 06:06:36 字数 200 浏览 5 评论 0原文

上周我一直在开发代码以使用 nuSoap 库连接到 Web 服务。我刚刚将代码部署到生产中,但立即开始出现我以前从未见过的错误。我将问题追溯到试图实例化新的soapclient 对象的一行代码。事实证明,这两个库都有一个名为“soapclient”的类,并且在生产中创建的类来自本机 Soap 库,而不是我包含的 nuSoap 库。如何禁用本机 Soap 功能并严格遵守 nuSoap?

I've spent the last week developing code to connect to a Web Service using the nuSoap library. I just deployed the code to production, but immediately started getting error's that I hadn't seen before. I traced the problem back to a line of code that is trying to instantiate a new soapclient object. It turns out that both libraries have a class named 'soapclient' and the one that's being created in production is from the native Soap library, not the nuSoap library that I'm including. How can I disable the native Soap functionality and stick strictly to nuSoap?

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

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

发布评论

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

评论(3

暖伴 2024-08-31 06:06:36

随着 PHP5 的发布,php_soap 扩展中包含了一个 soapclient 类。 NuSOAP 已将其类重命名为 nusoap_client。如果您的 NuSOAP 副本是最新的,您应该能够使用它。这不会禁用 php_soap 扩展,但应该允许您使用 NuSOAP 类而不会进一步发生冲突。

With the release of PHP5 there is a soapclient class included in the php_soap extension. NuSOAP has renamed its class to nusoap_client. If your copy of NuSOAP is current you should be able to use that. This doesn't disable the php_soap extension, but should allow you to use the NuSOAP class without further conflict.

嘦怹 2024-08-31 06:06:36

啊,没关系。 NuSoap 0.7.3(我正在使用)将类名更改为“nusoap_client”,专门为了避免这种冲突。它们还包括向后兼容性检查,如果未加载本机 Soap 扩展,则使用“soapclient”为该类别名,这就是为什么我没有在我的开发计算机上捕获它。

参考:http://code.google.com/ p/nusoap-for-php5/issues/detail?id=2

Ah, nevermind. NuSoap 0.7.3 (which I was using) changed the class name to 'nusoap_client' specifically to avoid this conflict. They also included a backward compatibility check that aliased that class with 'soapclient' if the native Soap extension wasn't loaded, which is why I didn't catch that on my development machine.

Ref: http://code.google.com/p/nusoap-for-php5/issues/detail?id=2

眉目亦如画i 2024-08-31 06:06:36

我不怪你,PHP 内置的soap 库是完整的,而且完全令人尴尬,特别是与Python Web 服务相比。

一种选择是在编译时删除扩展:

此扩展仅在以下情况下可用
PHP 配置为 --enable-soap。

另一种选择是在 nuSoap 中重命名soap-client。 Notepad++ 的搜索和替换效果很好,但您实际上不必这样做。

I don't blame you, the built in soap library for PHP is complete and total embarrassment, especially when compared to python web services.

One option is to remove the extension at compile time:

This extension is only available if
PHP was configured with --enable-soap.

Another option is to rename soap-client in nuSoap. Notepad++'s search and replace works well, but you really shouldn't have to do this.

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