Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Administrator
MSohm
Posts: 10,873
Registered: 07-09-2008
My Carrier: Bell

Web Services sample on BlackBerry JDE 4.5

Quote from the previous forum:


pdalva

Posts: 1
Registered: Jul, 2008

Web Services sample on BlackBerry JDE 4.5
Posted: Jul 30, 2008 4:55 PM
 
Hi...I would like to know please if there are an existing sample for using web services in BlackBerry (device/SimulatorS)

Thanks in advance


 

We do not have any BlackBerry specific samples on this, however you can refer to the JSR 172 samples available on the Internet.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
New Developer
johan_fox
Posts: 5
Registered: 08-14-2008

Re: Web Services sample on BlackBerry JDE 4.5

I've been searching the forums for examples of accessing a web service from a java app on the BB handset.  People have included snippets, but nothing to help newbies understand what is needed.  I have tried to follow examples using kSOAP2, but I get server-side errors that I don't see if I simply access the web service through a desktop browser.

 

I have tried to understand how to use the Sun Wireless toolkit to auto-generate stubs, but none of the tutorials I've found seem to be complete - they assume complete familiarity with the toolkit, which is new to me too.

 

When I have attempted to workout the gaps in these tutorials, the application errors anyway because the imports included in the auto-generated files aren't recognised:

import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.microedition.xml.rpc.Operation;
import javax.microedition.xml.rpc.Type;
import javax.microedition.xml.rpc.ComplexType;
import javax.microedition.xml.rpc.Element;

What are these, and do I need to replace them for BB equivalents?

 

Basically, what I've done is create a simple webservice called HelloWorld, that accepts one parameter.  It then returns 'HelloWorld + parameter'. 

 

I've then pointed the Sun Wireless toolkit stub generator to the WSDL, and imported the generated files in the BB JDE.

 

Then, I've run this code:

 

            Service1Soap_Stub test = new Service1Soap_Stub();
            try{
                String str = test.helloWorld("This is my parameter");
                System.out.println(str);
            }catch(Exception ex){
                System.out.println(ex.toString());
            } 

 

Is this correct??

 

 

Any help, advice, pointers, samples... anything would be much appreciated!

 

Johan

Please use plain text.
Administrator
MSohm
Posts: 10,873
Registered: 07-09-2008
My Carrier: Bell

Re: Web Services sample on BlackBerry JDE 4.5

What version of the BlackBerry JDE are you using?  The JSR 172 web service APIs were added in version 4.3.0 of the BlackBerry API set.  This means you need to use version 4.3.0 or higher of the BlackBerry JDE and require BlackBerry handheld software version 4.3.0 or higher.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
New Developer
johan_fox
Posts: 5
Registered: 08-14-2008

Re: Web Services sample on BlackBerry JDE 4.5

Thanks again Mark!

 

I have been using version 4.3.0 of the JDE, with a variety of simulators, however, I'm don't think that any of these simulators are 4.3.0 or above.

 

I've just downloaded JDE 4.6.0, and tried the same code with a Bold simulator, and it works just as I would expect.

 

Again, I am very thankful for your help - from a much happier Johan!

 

 

Please use plain text.
New Developer
jacytan
Posts: 88
Registered: 11-04-2008

Re: Web Services sample on BlackBerry JDE 4.5

Hi Mark,

 

You mentioned that JSR172 is supported only on devices with 4.3+ OS Versions.

 

I have a question. If let's say I have a device that has 4.2 OS Version, can i update the version of my OS to higher than 4.3 so that i can be able to support JSR172? Is this possible?

 

Or do i have to purchase another device that has already an OS version of 4.3+?

 

Hope to hear from you soon.

Please use plain text.
Developer
RexDoug
Posts: 4,573
Registered: 07-21-2008

Re: Web Services sample on BlackBerry JDE 4.5

That depends on the device and your carrier.

 

Check the carrier web site to find the latest OS version published for the device. OS 4.3 is available from almost every carrier as an upgrade, 4.5 is available for the Curve and Pearl devices from several carriers.

 

You can also download the BlackBerry-generic versions of the OS distributions from BB Universe site.

Please use plain text.
New Developer
jacytan
Posts: 88
Registered: 11-04-2008

Re: Web Services sample on BlackBerry JDE 4.5

Just to confirm, so if the update for the software is avalable, then it is possible? :smileyhappy:
Please use plain text.
Administrator
MSohm
Posts: 10,873
Registered: 07-09-2008
My Carrier: Bell

Re: Web Services sample on BlackBerry JDE 4.5

Yes, that is correct.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
New Developer
jacytan
Posts: 88
Registered: 11-04-2008

Re: Web Services sample on BlackBerry JDE 4.5

Thanks! :smileyhappy:
Please use plain text.
New Developer
ArthurKnight
Posts: 54
Registered: 10-07-2008

Re: Web Services sample on BlackBerry JDE 4.5

Hi there,

 

Good new for people from USA and Developed countries, for people like me, in Latin America, there is no update to version 4.3.0+ for any carrier. I tried to update a BB with a package for other carrier and the BB just stop work, I think there is some code or config for the specifics carrier. In some forums, I found that certain carriers and countries can be compatible, with other just not.

 

If you cannot upgrade to 4.3+, just use KSOAP, refer to the ksoap2 page at sourceforge. It works fine, but have some difficulties. JSR 172 is just simple, you make a stub and consume even complex objects. Beatyfull.

 

Regards!

Please use plain text.