Android Question Consuming Java Web Service with SOAP or another form

Avansys

Member
Licensed User
Longtime User
Consuming a Java web service is not different than consuming any other web service.

You should use HttpUtils2.

The actual details depend on the specific web service details.
Thanks Erel, let me read httputil's posts again and then I'll try it
 
Upvote 0

Avansys

Member
Licensed User
Longtime User
Hi Erel,

I tried to do this, but I could not do this whit HttpUtils2. I'm traying to do something like this (php):

<?php
include("lib/nusoap.php");
$client = new nusoap_client('192.168.169.135:8080/WebApplication1/NewWebService?wsdl','wsdl');
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

$param = array('name'=>'Pepe'); // se construye un array con la lista de parametros
$result = $client->call('hello',$param); //se manda a llamar la funcion hello y se le pasa el listado de parametros

if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
?>


I read android posts, I found that I need something like this:

try {

// Modelo el request
SoapObject request = new SoapObject(namespace, Metodo);
request.addProperty("Param", "valor"); // Paso parametros al WS

// Modelo el Sobre
SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
sobre.dotNet = true;
sobre.setOutputSoapObject(request);

// Modelo el transporte
HttpTransportSE transporte = new HttpTransportSE(url);

// Llamada
transporte.call(accionSoap, sobre);

// Resultado
SoapPrimitive resultado = (SoapPrimitive) sobre.getResponse();

Log.i("Resultado", resultado.toString());

} catch (Exception e) {
Log.e("ERROR", e.getMessage());
}


Some example or idea to do this?

Thanks
 
Last edited:
Upvote 0
Top