Error trying to consume WebService: Server did not recognize the value of the header

0

I'm experiencing the following error when trying to read a WebService:

SoapFault - faultcode: 'soap:Client' faultstring: 'O servidor não reconheceu o valor do cabeçalho HTTP SOAPAction: http://temuri.org/HelloWorld.' faultactor: 'null' detail: org.kxml2.kdom.Node@17a8faf7

Follow my Android Java code:

private void webservice(){
        String URN = "http://temuri.org/"; // Namespace do WebService
        String address = "http://192.168.1.105:8090/AngridWeb/WebService.asmx"; // URL do WebService
        String methodName = "HelloWorld";  // Nome do método
        String soapAction = "http://temuri.org/HelloWorld"; // Ação SOAP

        SoapObject request = new SoapObject(URN, methodName);
        SoapSerializationEnvelope envelope =
                new SoapSerializationEnvelope(SoapEnvelope.VER11);
        //request.addProperty("valor", numero);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE ht = new HttpTransportSE(address);
        ht.debug = true;
        try {
            ht.call(soapAction, envelope);
            String result = envelope.getResponse().toString();
            int fatorial = Integer.parseInt(result);
        } catch (org.xmlpull.v1.XmlPullParserException ex2) {
            Log.e("Err::", ex2.toString());
        } catch (Exception ex) {
            String msg = "Err2::" + ex.toString() + '\n' +
                    ht.requestDump + '\n' +
                    ht.responseDump + '\n';
            Log.e("Erro:", msg);
        }
    }

I've tried it in many ways. Changing soapAction also.

String soapAction = "http://temuri.org/AngridWeb/HelloWorld";

My WebService, very simple, done in C# :

namespace AngridWebServices
{
    /// <summary>
    /// Summary description for WebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
    }
}

It is hosted on my IIS.

I'm using the KSoap2 library to consume the WebService.

    
asked by anonymous 27.03.2015 / 19:05

1 answer

0

The Web Service Namespace and the SOAP header fields must be the same. In the case: Namespace = "http://tempuri.org/" , so URN must have the same Namespace value, as well as your soapAction request.

    
27.03.2015 / 19:50