Android consumindo web service soap

1 resposta
androidjava
R

Olá pessoal, sou iniciante no desenvolvimento Mobile, estou tendo dificuldades para consultar um web service soap, ele me retorna essa mensagem de erro no log

SoapFault - faultcode: '97' faultstring: 'Chave de integração inválida.' faultactor: 'Erro de integração' detail: org.kxml2.kdom.Node@636fb25
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:112)
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at routerbox.com.br.testwebservice.MainActivity.listaDetalhes(MainActivity.java:55)
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at routerbox.com.br.testwebservice.MainActivity.run(MainActivity.java:35)
10-17 09:40:53.923 22854-22887/routerbox.com.br.testwebservice W/System.err:     at java.lang.Thread.run(Thread.java:818)

esse é o xml que estou fazendo a consulta

<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">1</ID_Titulo>
             </tlDadosTitulosDetalhe>
          </lis:ListaDetalhe>
       </soapenv:Body>
    </soapenv:Envelope>

Esse é meu codigo java
public class MainActivity extends AppCompatActivity implements Runnable{

private ProgressDialog dialog;

<a class="mention" href="/u/override">@Override</a>

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);
dialog = ProgressDialog.show(MainActivity.this,
                "", "Listando detalhes...", true);

        new Thread(this).start();

    }


    @Override
    public void run() {
      listaDetalhes();
    }

    private void listaDetalhes() {
        SoapObject soap = new SoapObject("urn:RouterBoxMobile","ListaDetalhe");
        PropertyInfo propInfo=new PropertyInfo();
        propInfo.type=PropertyInfo.STRING_CLASS;
        soap.addProperty("ChaveIntegracao","3sW5vx3Kc3gHxix914d5y8L3sOxV093sGw2kL9345aDe3bV");


        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);

        envelope.setOutputSoapObject(soap);



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

        try {
            httpTransport.call("",envelope);

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

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

alguem pode me ajudar?

1 Resposta

R

Depois de muita pesquisa consegui resolver o problema.

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);
Criado 17 de outubro de 2016
Ultima resposta 18 de out. de 2016
Respostas 1
Participantes 1