Error while trying to consume Webservice: Server did not recognize the header value

Asked

Viewed 1,996 times

0

I am facing 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 code in Java Android:

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 have tried several ways. Changing the soapAction also.

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

My Webservice, very simple, made 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";
        }
    }
}

He’s staying at my IIS.

I’m using the Ksoap2 library to consume Webservice.

  • 1

    Your web service is with Namespace = "http://tempuri.org/" and on android you are going to the URN = "http://temuri.org/", just as in soap_action. Gives a check if that is it, then put of response.

  • Worse than that, @Murilofechio kkkkkk

1 answer

0


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

  • Correct! I was distracted at the time of putting the values.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.