BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-04-2009, 11:48 AM   #1 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8300
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default using webservice in a BB Java application

Please Login to Remove!

I want to use a Web Service (developed in Java) in my BB Java application.

I spent quite some time surfing the old posts in these forums and found "LOT" of questions regarding my very requirement. Unfortunately I didn't find a single solid response which dictates the steps to do this with some authority.

I really don't have any preference in terms of which IDE I would use for my development. I'm fine with JDE or Eclipse Plugin.

I'm targeting my app on devices with OS versions 4.5 and higher. So I've downloaded and installed everything required to develop my app for OS 4.5 from BlackBerry.com and latest and greatest Eclipse Plugin too.

Coming back to my original question... The closest one related to how to start with a web service client posted by a user 'sickned' in this post:

developer-forum/155972-blackberry-ksoap2-tutorial

But the problem is... I don't see some of the options he has indicated. For instance in my 'BB Eclipse Plugin IDE' I don't see...

'Right click at Eclipse and select "Add to build path"'

Right click where? I right clicked on the Eclipse, Library project, my Application... I don't see that option anywhere.

Next instruction...

Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder
again I don't find it.

I assume this could be because of the version of IDE I use.

Anyways I would really really appreciate if some one posts step by step instructions to...

1. Add a Web Reference to a BB Java project (assuming the .WSDL is available)
2. Make a simple Web Service call. (like 'ping' or something)

Thanks in advance.
Athma.
Offline  
Old 05-04-2009, 03:03 PM   #2 (permalink)
New Member
 
Join Date: May 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Unfortunatly, I'm no help with the Eclipse part, I use the JDE.

However, for the web service call, I'm not sure that you add a web reference. Using ksoap and a web reference seems redundant. Keep in mind, I'm used to using Visual Studio. ksoap wraps the call to the web service rather than the web reference.

The article that you referenced has a good example in the download file of creating the call to the web service. I've used that to create my web service calls and it works beautifully.
Offline  
Old 10-28-2009, 09:25 AM   #3 (permalink)
New Member
 
Join Date: Oct 2009
Model: 8300
PIN: N/A
Carrier: adad
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Not able to find HttpTransportBasicAuth class

Hi,
I am trying to call a webservice from a blackberry java app using ksoap2 library.In the sample programs given in some sites,they mentioned about HttpTransportBasicAuth class.
But I am not able to find the HttpTransportBasicAuth class in the org.ksoap2.transport package.I downloaded the preverified ksoap2 library from the old posts of this forum.
could any one help me on this.
Offline  
Old 12-18-2009, 04:28 AM   #4 (permalink)
New Member
 
Join Date: Nov 2009
Model: 8900
PIN: N/A
Carrier: Airtel
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Unable to call the method 'transport.call'

Tried out the sample application as a standalone java Appln.

HttpTransport transport = new HttpTransport("SOAP_ACTION_URL_HERE");

I was able to spawn out a new HttpTransport Object, but when using it to call the method
transport.call("URL_HERE",envelope);

I'm getting the error=>

Exception in thread "main" java.lang.ClassFormatError: Method <init> in class ja
vax/microedition/io/Connector has illegal modifiers: 0x102
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at org.ksoap2.transport.ServiceConnectionMidp.<init>( Unknown Source)
at org.ksoap2.transport.HttpTransport.getServiceConne ction(Unknown Sourc
e)
at org.ksoap2.transport.HttpTransport.call(Unknown Source)
at KSOAPDemo.main(KSOAPDemo.java:75)
============================
What cud' be the reason? Early advice would be great!
Offline  
Old 12-27-2009, 11:07 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2005
Model: 8830
Carrier: Verizon
Posts: 144
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

anilarkay,

My suggestion would be to break this down into separate steps. First I would get the connection/communication with your web service working. Then once you are able to interact and retrieve data from your web service you can move on to trying to get the ksoap working.

I've read numerous posts where people have a difficult time getting everything installed and set up correctly to use ksoap. For me, I just read the response from the web service into a string and parse the elements myself.

If you need further help, it would be helpful if you provide your code so we can take a look at what you are doing.

I use HttpConnection to interact with my web service, and you have to make sure you handle the various responses you can get back from the initial POST. The response you are looking for to keep going is HTTP_OK (200), but depending on your web service you may get other responses that you need deal with first (401 or HTTP_UNAUTHORIZED means you need to provide user credentials, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, etc).

fbrimm
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.