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
Developer
arunsingh
Posts: 52
Registered: ‎11-03-2008
My Device: Not Specified

Accessing .NET Web Service

Hi all,

 

I have a .NET web service having a set of methods that uses complex parameters (non-primitive ; like objects of classes defined in the web service class itself). Now, I want to access these methods in my blackberry application which I am developing using Blackberry JDE. I don't have any prior knowledge / experience of consuming web services from a java client.

 

Can anyone please help me how to do the same ?

 

Please remember that the parameters are non-primitive.

 

 

Thanks

- Arun

Please use plain text.
Developer
Developer
bo
Posts: 167
Registered: ‎11-12-2008
My Device: Not Specified

Re: Accessing .NET Web Service

I'm also looking for some guidance on this topic.  I've been unable to find much documentation thus far.
Please use plain text.
New Developer
ArthurKnight
Posts: 54
Registered: ‎10-07-2008
My Device: Not Specified

Re: Accessing .NET Web Service

Hi,

 

I´m currently in the development of a App for BlackBerry that consumes .NET WS.

 

I´m building a Java Midlet, to avoid the max dependencies with BlackBerry APIs, Java provides a functionality that is called JSR 172, and using the Wireless Toolkit you create code stubs for consuming web services. This JSR172 is contained within JMRuntime of the BlackBerry OS 4.5+, if you have a prior BB OS version, is not provided. Then you have an alternative that is use a java library called KSOAP2 that can consume .NET SOAP web services. There is plenty of tutorial of how to use it. Jus search the forum.

 

I had problems with complex objects, I found some tutorias that says that is suported but really I had many problems, so what I do is to send a Array of Strings  with the data separated by commas then parse it in the Midlet, i found it very easy.

 

I use Netbeans6.1 Mobility Pack, BlackBerry JDE 4.2 for models 8100 and 7100.

 

Just decide if you build a BB App or a Midlet, there are some differences, advantages and disadvantages that you have to analyse.

 

Hope this introduction helps.

 

Regards! :smileyhappy:

Please use plain text.
Developer
Developer
bo
Posts: 167
Registered: ‎11-12-2008
My Device: Not Specified

Re: Accessing .NET Web Service

ArthurKnight, thanks for the response.  So does this mean that since you're using BlackBerry JDE 4.2, you ended up using kSoap2?
Please use plain text.
Developer
arunsingh
Posts: 52
Registered: ‎11-03-2008
My Device: Not Specified

Re: Accessing .NET Web Service

Alright, I would go for the KSOAP library way. But how do I import and use that library in my project ? And also, can I receive an xml file as a HTTP response from the web service so that I can parse it ?

 

If yes, then how ?

 

 

 

 

Thanks

- Arun

Please use plain text.
New Developer
ArthurKnight
Posts: 54
Registered: ‎10-07-2008
My Device: Not Specified

Re: Accessing .NET Web Service


bo wrote:
ArthurKnight, thanks for the response.  So does this mean that since you're using BlackBerry JDE 4.2, you ended up using kSoap2?

Hi bo,

 

Yes I use Netbeans linked to BBJDE, the JSR172 for WS is not available with the Java VM of the BlackBerry version my devices have.

 

That is what I found, I don´t know if It is wrong, but it works for me.

 

Regards!

Please use plain text.
New Developer
ArthurKnight
Posts: 54
Registered: ‎10-07-2008
My Device: Not Specified

Re: Accessing .NET Web Service


arunsingh wrote:

Alright, I would go for the KSOAP library way. But how do I import and use that library in my project ? And also, can I receive an xml file as a HTTP response from the web service so that I can parse it ?

 

If yes, then how ?

 

 

 

 

Thanks

- Arun


 

There is a forum in SourceForge http://sourceforge.net/forum/forum.php?forum_id=532039  and there is alot of info about KSOAP.

 

In this forums, there are examples of how to use it.  You have to get a preverified ksoap library, I cannot attach it to the post, butyou can find it in http://www.blackberryforums.com/developer-forum/155972-blackberry-ksoap2-tutorial.html

 

In this forum there is plenty of examples.

 

Regards!

Please use plain text.
Developer
Developer
bo
Posts: 167
Registered: ‎11-12-2008
My Device: Not Specified

Re: Accessing .NET Web Service

ArthurKnight,

 

Thanks again for the reply.  I was able to get the ksoap preverified package working.  However, when I do a simple call to a web service hosted on my localhost I get an InterruptedIOException exception.  I've read that I might need the MDS simulator running at the same time, however, like you, I'm developing without BES.  Have you seen think problem before?

Please use plain text.
Developer
Developer
bo
Posts: 167
Registered: ‎11-12-2008
My Device: Not Specified

Re: Accessing .NET Web Service

I just realized I needed deviceside=true in the web service url.  How are you dealing with this insider you app from a programming perspective?  Are you just hardcoding deviceside=true after each web service url?
Please use plain text.
New Developer
jacytan
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Re: Accessing .NET Web Service

Hi,

 

I'm using ksoap2 library and i want to use the class HttpTransportBasicAuth.

I understand that this class is not included in the preverified core ksoap2 library.

It is in a separate file called ksoap-extras-2.1.2.jar or something like that, that i downloaded from sourceforge.net

I want to use this class in order to authenticate the user trying to access the web service by providing a username and password. I tried to verify this library but it always fails.

Can somebody help me on what i should do? Please help!

 

Thanks,

Jaclyn

Please use plain text.