开发者

SOAP doesn't work

开发者 https://www.devze.com 2023-01-11 21:22 出处:网络
I trying to work with SOAP, but it doesn\'t work. I tried localhost and another server. For example: soap.xml:

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 li开发者_开发百科ne 3896

Thanks for any help and sorry for my English.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消