Ciao a tutti,
ho il seguente problema, ho creato in ASP.NET un semplicissimo web service che ritorna semplicemente la stringa Hello World con il seguente codice:
codice:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace WebServiceForPhp
{
/// <summary>
/// Descrizione di riepilogo per Service1
/// </summary>
[WebService(Namespace = "http://localhost/WebServiceForPhp")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// Per consentire la chiamata di questo servizio Web dallo script utilizzando ASP.NET AJAX, rimuovere il commento dalla riga seguente.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string hello(string nome)
{
return "Hello World " + nome;
}
}
}
adesso vorrei richiamare il servizio da uno script php con il seguente codice:
codice:
$clientASP = new SoapClient(null, array('location'=>"http://localhost/WebServiceForPhp/Service1.asmx", 'uri'=>"urn:schemas-microsoft-com:asm.v1", 'trace'=>1));
$returnASP = $clientASP->__soapCall("hello",array("world"));
ma ottengo questo errore:
Fatal error: Uncaught SoapFault exception: [soap:Client] System.Web.Services.Protocols.SoapException: Valore dell'intestazione HTTP non riconosciuto dal server SOAPAction: urn:schemas-microsoft-com:asm.v1#hello. in System.Web.Services.Protocols.Soap11ServerProtocol Helper.RouteRequest() in System.Web.Services.Protocols.SoapServerProtocol.R outeRequest(SoapServerMessage message) in System.Web.Services.Protocols.SoapServerProtocol.I nitialize() in System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type, HttpContext context, HttpRequest request, HttpResponse response) in System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) in C:\wwwapache\bitServices\HelloClient.php:3 Stack trace: #0 C:\wwwapache\bitServices\HelloClient.php(3): SoapClient->__soapCall('hello', Array) #1 {main} thrown in C:\wwwapache\bitServices\HelloClient.php on line 3
Qualcuno ha idea di come fare?
Saluti