Complex type Android ksop2

Asked

Viewed 35 times

2

I’ve been working for days developing an application that consumes a Soap web service. Sending a complex type I’m getting, as I should do to send more of a complex type?

The integration key I can send you, but the ID, I can’t get through, what can I do to make it work? Below follows my code of how I am working.

SoapObject Autenticacao = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");

SoapObject chaveIntegracao = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");

chaveIntegracao.addProperty("ChaveIntegracao","########################");
Autenticacao.addSoapObject(chaveIntegracao);

SoapObject tlDadosTitulosDetalhe = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");
SoapObject idTitulo = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");
idTitulo.addProperty("ID_Titulo",@##);
tlDadosTitulosDetalhe.addSoapObject(idTitulo);


SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
        SoapEnvelope.VER11);


 envelope.setOutputSoapObject(Autenticacao);




Log.i("Testando web Service","");
String url="https://desenvtest.routerbox.com.br/routerbox/ws_teligo/rbx_server_mobile.php?wsdl";

HttpTransportSE httpTransport = new HttpTransportSE(url);
httpTransport.debug = true;




try {


    httpTransport.call("",envelope);

    SoapPrimitive msg = (SoapPrimitive)envelope.getResponse();

    Log.d("RouterBox", "Detalhes: " + msg);
} catch (IOException e) {
    e.printStackTrace();
} catch (XmlPullParserException e) {
    e.printStackTrace();
}

Follows xml

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:lis="ListaDetalhe">
   <soapenv:Header/>
   <soapenv:Body>
      <lis:ListaDetalhe soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <Autenticacao xsi:type="urn:Autenticacao" xmlns:urn="urn:RouterBoxMobile">
            <ChaveIntegracao xsi:type="xsd:string">?</ChaveIntegracao>
         </Autenticacao>
         <tlDadosTitulosDetalhe xsi:type="urn:tlDadosTitulosDetalhe" xmlns:urn="urn:RouterBoxMobile">
            <ID_Titulo xsi:type="xsd:int">?</ID_Titulo>
         </tlDadosTitulosDetalhe>
      </lis:ListaDetalhe>
   </soapenv:Body>
</soapenv:Envelope>

1 answer

2


After a lot of reading, I solved the problem. and managed to pass more of a complex type.

Just follow the code:

SoapObject request = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");


SoapObject chaveIntegracao = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");

chaveIntegracao.addProperty("ChaveIntegracao","?");
request.addProperty("Autenticacao",chaveIntegracao);



SoapObject idTitulo = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");

idTitulo.addProperty("ID_Titulo",1);


request.addProperty("tlDadosTitulosDetalhe",idTitulo);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
        SoapEnvelope.VER11);




 envelope.setOutputSoapObject(request);

Browser other questions tagged

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