bonjour,
je voudrais utiliser un web service en .net avec nuSoap, mais cela ne fonctionne pas
mon code:
<?php
require_once('../nusoap-0.7.2/lib/nusoap.php');
$soapaction = "http://www.webserviceX.NET/GetWeather";
$wsdl = "http://www.webservicex.com/globalweather.asmx";
$namespace = "http://www.webserviceX.NET/";
$client = new soapclient($wsdl);
$mysoapmsg = $client->serializeEnvelope('<GetWeather xmlns="http://www.webserviceX.NET/"><CityName xsi:type="xsd:string">lyon</CityName><CountryName xsi:type="xsd:string">france</CountryName></GetWeather>','',array(),'document','literal');
$response = $client->send($mysoapmsg, $soapaction);
print_r($response);
echo '<h2>Requête</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Réponse</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
?>
Le réponse que je reçois:
Array ( [faultcode] => soap:Server [faultstring] => System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or Function 'getWeather' expects parameter '@CountryName', which was not supplied. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at WebServicex.GlobalWeather.GetWeather(String CityName, String CountryName) --- End of inner exception stack trace --- [detail] => )
Requête
POST /globalweather.asmx HTTP/1.0
Host: www.webservicex.com
User-Agent: NuSOAP/0.7.2 (1.94)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "http://www.webserviceX.NET/GetWeather"
Content-Length: 560
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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><GetWeather xmlns="http://www.webserviceX.NET/"><CityName xsi:type="xsd:string">lyon</CityName><CountryName xsi:type="xsd:string">france</CountryName></GetWeather></SOAP-ENV:Body></SOAP-ENV:Envelope>
Réponse
HTTP/1.1 500 Internal Server Error.
Connection: close
Date: Fri, 01 Jun 2007 08:24:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 925
<?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>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or Function 'getWeather' expects parameter '@CountryName', which was not supplied.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at WebServicex.GlobalWeather.GetWeather(String CityName, String CountryName)
--- End of inner exception stack trace ---</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
quelqu'un aurait il une idée ?
merci beaucoup
sandrillon