I am consuming tempconvert web services but it does not give any result just show blank screen.
Does that mean my app does not access the web services, or i have to some setting so it will connect to URL, i am using ksoap2 2.6.5 .
this is my code
package com.example.webservice2;
import android.os.Bundle;
import android.widget.TextView;
import android.app.Activity;
import org.ksoap2.*;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class WebService extends Activity {
private final String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";
private final String METHOD_NAME = "CelsiusToFahrenheit";
private final String NAMESPACE = "http://tempuri.org/";
private final String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.tv);
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
Request.addProperty("celsius", "32");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(Request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
tv.setText("status:" + response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
i am using web service from this url
http://www.w3schools.com/webservices/tempconvert.asmx
Sometime when you are on the proxy network and not set the proxy setting than this occured check that you are not on proxy network.