This is a simple dollar conversion web service:
public class Callsoap {
String resultado;
String erro = null;
public String Call (String ip, String porta, float n){
String SOAP_ADDRESS = "http://"+ip+":"+porta+"/webservice/WebService.asmx?wsdl";
String WSDL_TARGET_NAMESPACE = "http://tempuri.org";
String OPERATION_NAME = "Conversor";
String SOAP_ACTION = "http://tempuri.org/Conversor";
int Timeout = 60000;
HttpTransportSE ht;
SoapObject request;
request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
request.addProperty("n",String.valueOf(n));
SoapSerializationEnvelope envelope = getSoapSerializationEnvelope(request);
ht = new HttpTransportSE(Proxy.NO_PROXY,SOAP_ADDRESS,Timeout);
try{
ht.call(SOAP_ACTION,envelope);
ht.debug = true;
ht.setXmlVersionTag("<!--?xml version=\"1.0\" encoding= \"UTF-8\" ?-->");
SoapObject resultadoXML = (SoapObject) envelope.bodyIn;
SoapPrimitive resultados = (SoapPrimitive) resultadoXML.getProperty("ConversorResult");
resultado = resultados.toString();
}catch (Exception e){
return erro = e.toString();
}
request = null;
ht = null;
envelope = null;
return resultado;
}
private final SoapSerializationEnvelope getSoapSerializationEnvelope(SoapObject request) {
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.implicitTypes = true;
envelope.setAddAdornments(false);
envelope.setOutputSoapObject(request);
return envelope;
}
}