Click here to Skip to main content
15,885,871 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hi guys i am new at android development but i could not get my web service working help is much appreciated. I have no idea what should i do from now on i have been goggling fro days. Thanks
The problem what am i suppose to do next and i am not sure am i connected to the web service.

public class FirstScreen extends Activity {
    /** Called when the activity is first created. */
	private static final String SOAP_ACTION= "StockQuoteService";
	private static final String URL = "http://www.restfulwebservices.net/wcf/StockQuoteService.svc?wsdl";	
	private static final String NAMESPACE = "http://www.restfulwebservices.net/ServiceContracts/2008/01";
	private static final String METHOD_NAME = "GetStockQuote";
	TextView tv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tv = (TextView)findViewById(R.id.textView1);
    	
    	SoapObject Request = new SoapObject(NAMESPACE,METHOD_NAME);
    	Request.addProperty("", "");
    	
    	SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    	soapEnvelope.dotNet = true;
    	soapEnvelope.setOutputSoapObject(Request);
    	
    	AndroidHttpTransport aht = new AndroidHttpTransport(URL);
    	try
    	{
    		aht.call(SOAP_ACTION, soapEnvelope);
    		SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
    		tv.setText("Status :" + resultString );
    	}
    	catch(Exception e)
    	{
    		e.printStackTrace();
    	}
    	}
    }
Posted
Comments
_Ares!!! 25-May-11 8:44am    
What do you want to do? Describe your question in details...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900