4
I am doing a query of customers in a web service, step the key to see what it returns me tells that I did not pass the key, what I may be doing wrong in the method?
That’s the .xml
of consultation
<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:con="ConsultaClientes">
<soapenv:Header/>
<soapenv:Body>
<con:ConsultaClientes soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Autenticacao xsi:type="urn:Autenticacao" xmlns:urn="urn:RouterBoxConsultas">
<ChaveIntegracao xsi:type="xsd:string">?</ChaveIntegracao>
</Autenticacao>
</con:ConsultaClientes>
</soapenv:Body>
</soapenv:Envelope>
private void consultaClientes() {
SoapObject soap = new SoapObject("urn:RouterBoxConsultas", "ConsultaClientes");
soap.addProperty("ChaveIntegracao", this.chaveDeIntegracao);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(soap);
Log.i("RouterBox", "Chamando WebService para consulta de Clientes");
String url ="https://############################################";
HttpTransportSE httpTransport = new HttpTransportSE(url);
try {
httpTransport.call("ConsultaClientes", envelope);
Object msg = envelope.getResponse();
Log.d("RouterBox", "Clientes: " + msg);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
}
[ 09-28 08:59:50.339 14659:14685 D/ ]
HostConnection::get() New Host Connection established 0xec60cc00, tid 14685
09-28 08:59:50.348 14659-14685/br.com.testes.consultaclientes I/OpenGLRenderer: Initialized EGL, version 1.4
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: SoapFault - faultcode: '96' faultstring: 'Chave de Integracao nao informada' faultactor: '' detail: org.kxml2.kdom.Node@fa9adea
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(Unknown Source)
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at org.ksoap2.SoapEnvelope.parse(Unknown Source)
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at org.ksoap2.transport.Transport.parseResponse(Unknown Source)
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at org.ksoap2.transport.HttpTransportSE.call(Unknown Source)
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at br.com.testes.consultaclientes.MainActivity.consultaClientes(MainActivity.java:57)
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at br.com.testes.consultaclientes.MainActivity.run(MainActivity.java:36)
09-28 08:59:50.383 14659-14695/br.com.testes.consultaclientes W/System.err: at java.lang.Thread.run(Thread.java:818)
09-28 08:59:50.423 14659-14685/br.com.testes.consultaclientes W/EGL_emulation: eglSurfaceAttrib not implemented
You can debug and check if you are actually passing the key correctly?
– viana
Yes, but the key is being passed by a global attribute by Soap.addProperty("Keyintegration", this.keyDeIntegration); @seamusd
– rodrigo.oliveira
And where do you assign a value to this.chaveDeIntegration ? Checked whether you are assigning it correctly. If in case you are doing this and still are returning error, maybe it is in your webservice the problem.
– viana
I just debug, it shows me key correctly. By Soapui I did the test, it gives me the correct return. @seamusd
– rodrigo.oliveira
There too, I see that you are not making any reference to "Authentication". Keyintegration is an object that is inside Authentication. Try to check this!
– viana
@seamusd, I’m a beginner , could you give me an example how I could make this reference to Authentication?
– rodrigo.oliveira
Let’s go continue this discussion in chat.
– rodrigo.oliveira