I had connected Android with a webservice using Volley. When connect to url, return me a xml file. The returned xml, contain a function, that i need execute.
Ok, volley don't have a xml parser, I use a 'Simple' xml serializator.
All fine, I'm connectet to webservice, I parsed xml, and have a POJO file for this. Now, how can I do for execute the returned function in xml? I can with volley? I need pass a value into function and receive result.
The xml code:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/ServicioPrueba" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/ServicioPrueba">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/ServicioPrueba">
<element name="Pruebaaaaaa">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="inputstring" type="string"/>
</sequence>
</complexType>
</element>
<element name="Pruebaaaaaa_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="Pruebaaaaaa">
<part name="parameters" element="tns:Pruebaaaaaa"/>
</message>
<message name="Pruebaaaaaa_Result">
<part name="parameters" element="tns:Pruebaaaaaa_Result"/>
</message>
<portType name="ServicioPrueba_Port">
<operation name="Pruebaaaaaa">
<input name="Pruebaaaaaa" message="tns:Pruebaaaaaa"/>
<output name="Pruebaaaaaa_Result" message="tns:Pruebaaaaaa_Result"/>
</operation>
</portType>
<binding name="ServicioPrueba_Binding" type="tns:ServicioPrueba_Port">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Pruebaaaaaa">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/ServicioPrueba:Pruebaaaaaa" style="document"/>
<input name="Pruebaaaaaa">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Pruebaaaaaa_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<service name="ServicioPrueba">
<port name="ServicioPrueba_Port" binding="tns:ServicioPrueba_Binding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="https://portatil-gjm.olivia.olivia-sistemas.com:7047/DynamicsNAV100/WS/CRONUS%20Espa%C3%B1a%20S.A./Codeunit/ServicioPrueba"/>
</port>
</service>
</definitions>
The part of the connection in VolleY:
String url = "http://XXXXXXXXX";
SimpleXmlRequest<definitions> simpleRequest = new SimpleXmlRequest<definitions>(Request.Method.GET, url, definitions.class,
new Response.Listener<definitions>()
{
@Override
public void onResponse(definitions response) {
// response Object
Log.d("WORKS", "onResponse: "+response.getTypes().getSchema());
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
// error Object
}
}
){
@Override
public Map<String, String> getHeaders() {
Map<String, String> params = new HashMap<String, String>();
params.put(
"Authorization",
String.format("Basic %s", Base64.encodeToString(
String.format("%s:%s", "xxxxx", "xxxx").getBytes(), Base64.NO_WRAP)));
return params;
}};
queue.add(simpleRequest);