Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
krishna85
Posts: 36
Registered: ‎10-12-2012
My Device: developer

ksoap problem

 public void webservice()
    {
    	Dialog.alert("Hello");
    	add(new RichTextField(":start process:"));
    	
    	//connectivity with the web server
    	String serviceurl = "http://www.webservicex.net/globalweather.asmx";
    	String serviceNamespace = "http://www.webserviceX.NET";
    	String soapAction = "http://www.webserviceX.NET/GetWeather";
    	
    	SoapObject rpc = new SoapObject(serviceNamespace, "GetWeather");
    	rpc.addProperty("CityName", "Delhi");
    	rpc.addProperty("CountryName", "India");
    	SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    	envelope.bodyOut=rpc;
    	envelope.dotNet=true;
    	envelope.encodingStyle= SoapSerializationEnvelope.XSD;
    	//rpc.addProperty("Message", (new Date()).toString());
    	
    	
    	
    	HttpTransport ht = new HttpTransport(serviceurl);
   
    	ht.debug=true;
    	result = "";
    	try{
    		ht.call(soapAction,envelope);
    		result = (envelope.getResponse().toString());
    		
    	}catch(Exception e)
    	{
    		Dialog.alert(e.toString());
    		
    	}
    //	add(new RichTextField("==->"+result));
    	parsexml();
    	
    }

 i have done webservice connectivity using this method... is there any other way in which u can pass service url,service namespace and soap action in an xml and pass it through ht.setxmlversiontag() method ...

 

pls....help i just want to know is there any other method other than this in ksoap

 

Please use plain text.
Developer
simon_hain
Posts: 16,133
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: ksoap problem

first, review this:
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865
(don't do networking on the event thread)

regarding ksoap i can only suggest to test code with desktop java (j2se) using httptransportSE, all other code runs on both platforms. you get much quicker debugging and better error output.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.