-2
This is a simple dollar conversion webservice:
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;
}
}
Give more information about the problem. This code is not C#.
– Maniero
This is an Android app and send a variable to multiply within the webservice and back a number. But always returns 0
– Silas P Silva
So this isn’t C, right?
– Maniero
Yes right! is Android trying to connect on a Webservice . net
– Silas P Silva
Edith your question, make the necessary changes to the
tags
and also add more information to better build your question. I when I formatted the question code also added the tagC#
depending on the information of the title, as I do not notice anything of both languages, but you should edit it and add/remove tags depending on your snap context.– Chun
Webssrvice is running in debug or you published it?
– Filipe Oliveira
I posted it on the local IIS
– Silas P Silva