2012-06-06 12 views
5

Mi servicio web .net aparentemente está ejecutando soap 1.2 (al marcar el .wsdl) y he estado intentando acceder al servicio web helloworld para probarlo, pero he encontrado errores. Estoy tratando de hacer esto a través del emulador por cierto.soap 1.2 android Proporcione una acción de jabon válida

Así que cuando uso la versión 1.2 de soap, aparece el error de que "no se puede gestionar la solicitud sin un parámetro de acción válido. Proporcione una clave válida" Quiero saber qué es lo que me falta y qué debo hacer .

¡Gracias!

cosas que ya he hecho:

  • Añadir permiso para android utilizar internet
  • Cambio de jabón versión 1.1 y 1.2
  • Cambio de SoapObject al objeto (por tanto el jabón 1.1 y 1.2)
  • usados ​​10.0.2.2 para el emulador
  • comprueban los errores en la ortografía en las direcciones y nombres de los métodos

Mis códigos:

private static final String NAMESPACE = "http://localhost/WebService/"; 
private static final String URL = "http://10.0.2.2:1672/Eventurous/WsEventurousMobile.asmx"; 
private static final String HelloWorld_SOAP_ACTION = "http://localhost/WebService/HelloWorld"; 
private static final String METHOD_NAME1 = "HelloWorld"; 



... 
... 

public static String GetHelloWorld() { 

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1); 
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
    SoapEnvelope.VER12); 
    envelope.dotNet = true; 
    envelope.setOutputSoapObject(request); 
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL,60000); 

    try { 
    androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); 
    androidHttpTransport.call(HelloWorld_SOAP_ACTION, envelope); 

    SoapObject response = (SoapObject)envelope.getResponse(); 
    String result = response.getProperty(0).toString(); 

    return result; 
    } catch (Exception e) { 
    return e.toString(); 
    } 

} 

de error para la versión Jabón 1,2

Code: soap:Sender, Reason: System.Web.Services.Protocols.SoapException: Unable to handle request without a valid action parameter. Please supply a valid soap action. 

at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest() 

at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) 

at System.Web.Services.Protocols.SoapServerProtocol.Initialize() 

at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean 

de error para la versión Jabón 1,1

SoapFault - faultcode: 'soap:Client' faultstring: 'System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost/WebService/HelloWorld. 

at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() 

at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) 

at System.Web.Services.Protocols.SoapServerProtocol.Initialize() 

at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)' faultactor: 'null' detail: [email protected] 

Respuesta

0

uso SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

en lugar de

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
    SoapEnvelope.VER12); 

y quitar esta línea androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");

y en lugar de SoapObject response = (SoapObject)envelope.getResponse();

uso SoapObject response = (SoapObject)envelope.bodyIn;

Esto ayudará you.If aún así obtener un error entonces Escríbeme.

Cuestiones relacionadas