2

Estou trabalhando a dias desenvolvendo uma aplicação que consuma um web service Soap. Enviando um tipo complexo estou conseguindo, como eu deveria fazer para mandar mais de um tipo complexo?

A chave de integracao consigo enviar, mas o ID, não consigo passar, o que posso fazer para dar certo? Abaixo segue meu codigo de como estou trabalhando.

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();
}

Segue 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 Resposta 1

2

Depois de muita leitura, resolvi o problema. e consegui passar mais de um tipo complexo.

Segue como ficou o codigo:

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);

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .