Mam problem z biblioteką NuSOAP.
Napisałem bardzo prosty WebService w .Net, uruchomiony jest na Windows XP SP2, IIS 5.1.
Próbuję go "skonsumować" z drugiego komputera ze strony php i tu pojawia się problem, bo do WebService'u nie jest przekazywany wymagany parametr. Natomiast to co zwraca WebService wykrywane jest poprawnie.
Kod php wygląda tak:
<?php $wsdl=\"http://192.168.1.101/ws/Service.asmx\"; require_once('lib\nusoap.php'); $client = new soapclient($wsdl); $param='test'; $return = $client->call('HelloWorld',$params,'http://tempuri.org/','http://tempuri.org/HelloWorld',null,false,'rpc','literal'); if(!$err = $client->getError()) { } else { } ?>
Dwie ostatnie linie, czyli request i response są zwracane następująco:
request:
Kod
POST /ws/Service.asmx HTTP/1.0
Host: 192.168.1.101
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://tempuri.org/HelloWorld"
Content-Length: 418
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns5541:HelloWorld
xmlns:ns5541="http://tempuri.org/"><name>test</name></ns5541:HelloWorld></SOAP-ENV:Body></SOAP-ENV:Envelope>
HTTP/1.1
Host: 192.168.1.101
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://tempuri.org/HelloWorld"
Content-Length: 418
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns5541:HelloWorld
xmlns:ns5541="http://tempuri.org/"><name>test</name></ns5541:HelloWorld></SOAP-ENV:Body></SOAP-ENV:Envelope>
HTTP/1.1
response:
Kod
200 OK
Server: Microsoft-IIS/5.1
Date: Mon, 17 Mar 2008 15:30:56 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 354
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><HelloWorldResponse
xmlns="http://tempuri.org/"><HelloWorldResult>_echo_web_service</HelloWorldResult></HelloWorldResponse></soap:Body></soap:Envelope>
Server: Microsoft-IIS/5.1
Date: Mon, 17 Mar 2008 15:30:56 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 354
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><HelloWorldResponse
xmlns="http://tempuri.org/"><HelloWorldResult>_echo_web_service</HelloWorldResult></HelloWorldResponse></soap:Body></soap:Envelope>
Wartość "_echo_web_service" to standardowa wartość dodawana do stringa zwracanego z webservice'u, niestety parametr name w funkcji HelloWorld na serwerze jest pusty, prawidłowy wynik powinien być: "test_echo_web_service".
Gdzie jest błąd?
Pozdrawiam.