0

I've already searched for similar questions but no answer has worked for me

I have this code inside a function that is called from an AsyncTask in android

SoapObject Request=new SoapObject(NAMESPACE, METHOD_NAME3);

Request.addProperty("mac",emac.getText().toString());
Request.addProperty("name",eusu.getText().toString());
Request.addProperty("status",usuData[0]);
Request.addProperty("cEmpSmarpa",usuData[1]);


SoapSerializationEnvelope envelope =  new 
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;

envelope.headerOut = new Element[1];
envelope.headerOut[0] = buildAuthHeader();

envelope.setOutputSoapObject(Request);


HttpTransportSE transpor = new HttpTransportSE(URL);
transpor.debug = true;
transpor.call(SOAP_ACTION3,envelope);

resultString=(SoapObject) envelope.getResponse();

And with it, I'm sending this XML to my web service

<soapenv:Body>
     <grup:Update>
           <grup:mac>MAC</grup:mac>

           <grup:name>NAME</grup:usuario>

           <grup:status>1</grup:estatus>

           <grup:cEmpSmarpa>0</grup:cEmpresasSmarpa>
     </grup:Update>
</soapenv:Body>

but it is not working since I need to send it like this

<soapenv:Body>
      <grup:Update>    
         <grup:user>
            <grup:mac>MAC</grup:mac>

            <grup:name>NAME</grup:usuario>

            <grup:status>1</grup:estatus>

            <grup:cEmpSmarpa>0</grup:cEmpresasSmarpa>

         </grup:user>
      </grup:Update>
</soapenv:Body>

How can I add that extra group called user that contains my properties?

Fdde F
  • 93
  • 11
  • I dont know if I can help but you can look at my solution: https://stackoverflow.com/questions/9396805/create-soap-request-using-ksoap-android/71084717#71084717 – Herman Van Der Blom Feb 11 '22 at 18:17

1 Answers1

0

I did this:

SoapObject Request=new SoapObject(NAMESPACE, METHOD_NAME3);

SoapObject Soapusuario = new SoapObject(NAMESPACE, "user");

            PropertyInfo pi = new PropertyInfo();
            pi.setNamespace(NAMESPACE);
            pi.setType(PropertyInfo.OBJECT_CLASS);
            pi.setName("user");
            pi.setValue("");
            Soapusuario.addProperty(pi);

but then I was getting some "i:type=user" field error, so I added

envelope.implicitTypes = true; 

and that solved it.

Fdde F
  • 93
  • 11