SOAP 不起作用
我尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许 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.
从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.