SOAP 不起作用

发布于 2024-09-14 10:55:25 字数 1218 浏览 6 评论 0原文

我尝试使用 SOAP,但它不起作用。我尝试了本地主机和另一台服务器。例如: soap.xml:

POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
  <m:GetStockPrice>
    <m:StockName>IBM</m:StockName>
  </m:GetStockPrice>
</soap:Body>

</soap:Envelope>

结果是:

XML 解析错误:语法错误 地点: http://w3.localhost/soap/soap.xml 行 第 1 号,第 1 栏:POST /InStock HTTP/1.1 ^

phpinfo:

soap
Soap Client     enabled
Soap Server     enabled 

apache mime.types

application/fastsoap
application/soap+fastinfoset
application/soap+xml

我也尝试过使用 nusoap,但 example.php 显示了此错误:

致命错误:无法在中重新声明类肥皂客户端C:\xampp\htdocs\w3\soap\nusoap.php on line 3896

感谢您的帮助,并对我的英语表示抱歉。

I trying to work with SOAP, but it doesn't work. I tried localhost and another server. For example:
soap.xml:

POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
  <m:GetStockPrice>
    <m:StockName>IBM</m:StockName>
  </m:GetStockPrice>
</soap:Body>

</soap:Envelope>

and result is:

XML Parsing Error: syntax error
Location:
http://w3.localhost/soap/soap.xml Line
Number 1, Column 1:POST /InStock
HTTP/1.1 ^

phpinfo:

soap
Soap Client     enabled
Soap Server     enabled 

apache mime.types

application/fastsoap
application/soap+fastinfoset
application/soap+xml

I tried with nusoap too, but example.php shows me this error:

Fatal error: Cannot redeclare class soapclient in C:\xampp\htdocs\w3\soap\nusoap.php on line 3896

Thanks for any help and sorry for my English.

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

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

发布评论

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

评论(2

孤星 2024-09-21 10:55:25

也许 PHP 版本已经过时了。 SOAP 内置于 PHP5 中,因此不需要使用 NuSOAP。

注意:我想说的是,实际上有许多非 SOAP 相关的问题可能会导致该错误。

perhaps the PHP version is out of date. SOAP is built into PHP5, so there shouldn't be a need to use NuSOAP.

Note: I want to say that there are actually many non SOAP related problems that can cause that error.

彩扇题诗 2024-09-21 10:55:25

从soap.xml 中删除HTTP 标头,以便仅保留有效负载(SOAP/XML),并且它应该可以工作。

Remove the HTTP-Header from your soap.xml, so that only the valid payload (SOAP/XML) remains and it should work.

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