getting java.io.IOException: HTTP request failed, HTTP status: 404 in ksoap2 while passing xml data to soap1.2 android

后端 未结 2 1717
有刺的猬
有刺的猬 2020-12-06 15:10

i have to pass


test@test.com
test         


        
2条回答
  •  青春惊慌失措
    2020-12-06 15:35

    If still relevant..

    First of all, you should change URL to http://myurl.com/Service.svc/Service.svc. It will solve 404 error.

    Further you should change

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    

    to

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
    

    Further you should add wsa:To and wsa:Action headers like this:

            Element e = new Element();
            e.setName("To");
            e.setNamespace("http://www.w3.org/2005/08/addressing");
            e.addChild(Node.TEXT,"http://myurl.com/Service.svc/Service.svc");
    
            Element e1 = new Element();
            e1.setName("Action");
            e1.setNamespace("http://www.w3.org/2005/08/addressing");
            e1.addChild(Node.TEXT,"http://tempuri.org/ISilentManagerAPI/Service");
    
            envelope.headerOut = new Element[]{e,e1};
    

    I hope it is helpful.

    Edit: Try to change req to:

     PropertyInfo req = new PropertyInfo();
            req.name = "xmlstring";
            req.namespace=NAMESPACE;
            req.type = String.class;
            req.setValue("test@test.comtest");
            request.addProperty(req);
    

    ie change req.name to xmlstring and set namespace.

提交回复
热议问题