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
Visitor
Posts: 1
Registered: ‎09-04-2013
My Device: Bold 9790
My Carrier: Vodaphone

Error in calling web service

 public void login(String compShrtName, String UserID, String Pwd)
	 throws IOException {
	
	 String serviceUrl =
	 "http://tna.xbizventures.com/tna/wservice/wsdata.asmx;interface=wifi";
	 String serviceNamespace = "http://tempuri.org/ ";
	 String soapAction = "http://tempuri.org/HelloWorld";
	 String servicemethod = "HelloWorld";
	
	 SoapObject soap = new SoapObject(serviceNamespace, servicemethod);
	
	 soap.addProperty("company".trim(), compShrtName.toString());
	 soap.addProperty("userId".trim(), UserID.toString());
	 soap.addProperty("password".trim(), Pwd.toString());
	 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
	 SoapEnvelope.VER11);
	
	 envelope.setOutputSoapObject(soap);
	 envelope.bodyOut = soap;
	 envelope.dotNet = true;
	 envelope.encodingStyle = SoapSerializationEnvelope.XSD;
	 envelope.setOutputSoapObject(soap);
	 HttpTransport ht = new HttpTransport(serviceUrl);
	
	 ht.debug = true;
	 ht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
	 String response;
	 try {
	
	 ht.call(soapAction, envelope);
	 response = (String) envelope.getResponse();//
	 Dialog.inform("Webservice ");
	 // return reponse;
	 Dialog.inform(response.toString());
	 Dialog.alert(response.toString());
	
	 } catch (Exception ex) {
	
	 response = ex.toString();
	 Dialog.inform(ex.getMessage());
	 }
	
	 }
	
	
	 public void xml() throws IOException {
	
	 }


m getting error of ksoap2 not found...and also verification error...

 

Developer
Posts: 95
Registered: ‎07-24-2013
My Device: 9380
My Carrier: Airtel

Re: Error in calling web service

Hi,

  Could you tell us please when you are getting this error.....usually users get this error when you are going to start the app..(either clicking on the app icon or by any other means..)...

 

  I think you've not referenced the ksoap library correctly into your project..... you can do thios by going into the Build Path link on right clicking the project name..

 

Warm Regards.

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Error in calling web service

welcome to the support forums.

please note that you should not execute networking on the event thread, use a new thread for that:
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865

(you will have to wrap your dialog calls into invokelater then)

you can search for ksoap2 in the forum. most likely it is a build setup issue (mark it for export).
----------------------------------------------------------
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