0

I am using SOAP service in my application.In that i am receiving the error message

 SoapFault - faultcode: 'soap:Client' faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 301). ---> System.InvalidOperationException: The specified type was not recognized: name='authentication',

My SOAP request structure is:

 <authentication>
    <LoginID>string</LoginID>
    <Password>string</Password>
  </authentication>
  <Id>int</Id>
  <Str>string</Str>   

My code is:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

                PropertyInfo usrid =new PropertyInfo();
            usrid.setName("LoginID");
            usrid.setValue(userid);
            usrid.setType(String.class);
            request.addProperty(usrid);        

//          
            PropertyInfo pass =new PropertyInfo();
            pass.setName("Password");
            pass.setValue(password);
            pass.setType(String.class);
            request.addProperty(pass);

                PropertyInfo rote =new PropertyInfo();
            rote.setName("Id");
            rote.setValue(4114616);
            rote.setType(int.class);
            request.addProperty(rote);
//          
            PropertyInfo dte =new PropertyInfo();
            dte.setName("Str");
            dte.setValue(date);
            dte.setType(String.class);
            request.addProperty(dte);



 androidHttpTransport.call(SOAP_ACTION,envelope);              
//              SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
                System.out.println("subbu");
                Object response=(Object)envelope.getResponse();---->I think i am getting error here.

Can anybody please help what i have done wrong.

subburaj
  • 161
  • 2
  • 15

1 Answers1

1

Check out the following links:

authentication is a complex object but you have added all the properties in a row. Try something like this:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

SoapObject authenticate = new SoapObject(NAMESPACE, "authenticate");
authenticate.addProperty("LoginID", "login");
authenticate.addProperty("Password", "password");

request.addSoapObject(authenticate);
request.addProperty("Id", "123");
request.addProperty("Str", "string");
StenaviN
  • 3,687
  • 24
  • 34
  • First of all, you didn't post your code, so it is hard to say "_what have you did wrong_". – StenaviN May 16 '12 at 05:22
  • StenaviN ,i tried your code but in the line request.addSoapObject(authenticate); in my code its not supporting addSoapObject.After request. it shows nothing relates to addSoapObject.. – subburaj May 16 '12 at 07:02
  • Thanks to all .its solved..Actually the problem is the version of SOAP jar file.Previously i used 2.5.2 now i am using 2.6.0. – subburaj May 16 '12 at 07:52