Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
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 22-May-11 2:09am
Comments
_Ares!!! at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 359
1 Richard MacCutchan 320
2 OriginalGriff 280
3 Jared Sanow 145
4 Snehasish_Nandy 115
0 Sergey Alexandrovich Kryukov 5,939
1 OriginalGriff 4,885
2 CPallini 2,473
3 Abhinav S 1,507
4 Richard MacCutchan 1,437


Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 22 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100