[TIP] Connecting to a webservice in 5 minutes

It's so simple to create a j2me client that connects to a web service with Mobility Pack for NetBeans 5.0 I needed less than 5 minutes to create simple client.

Steps to create J2ME Web Service Client in latest q-build of mobility (or a build after 09/19):
  • Have a j2me project
  • 'New File/Folder' then 'MIDP | J2ME Web Services Client'
  • provide WSDL URL/file for you webservice (e.g. QuoteService that is used in NetBeans IDE 5.0 Quick Start Guide for Web Service Clients
  • set up your proxy and port properly
  • Retrieve WSDL
  • check 'Create Sample MIDlet' checkbox and the wizard will create simple midlet for you
  • run project
  • launch the midlet
Don't be suprised that some methods return empty form when you generate it for a webservice. This methods bodies are empty and they wait for your implementation. The QuteService is simple and returns only string but you can notice it when you generate client for a webservice that returns complex type. That's because the sample midlet doesn't know how to handle complex types. Field for the returned value of the complex type is generated and you just write method body to specify how to display the complex type. I'll show it later how to handle it.
There can be problems with connection if you are behind firewall - don't forget to set up proxy.

There aren't much devices with JSR172 support but you can try this project with WTK emulator. This project use QuoteService. I didn't wrote a line in this project - everything was generated by the wizard.

Geertjan, what do you think? Isn't it time to try the mobility pack? The latest q-build (it contains J2ME Web Services Client) is available here.
Comments:

Yup, as soon as we're past Beta, I'll definitely try this!!! I think the web service client quick start tutorial should be extended to include the scenario you describe, even though mobility docs are separate from other netbeans docs. How cool would it be to have a web service client quick start doc that includes (1) J2SE, (2) web, AND (3) mobility?

Posted by Geertjan on September 21, 2005 at 03:56 AM CEST #

Yes, that would be cool. I'll try to use Web Service Client from your tutorial and create j2me client for it and I'll describe it here

Posted by Lukas on September 21, 2005 at 04:05 AM CEST #

Another good one would be the spell check web service (click here for the tutorial). It would be pretty cool if you could use it to check the spelling of a text message in your mobile phone. And if there is a spelling error, the message would not be sent...

Posted by Geertjan on September 21, 2005 at 05:15 AM CEST #

Well, it shouldn't be difficult to create a client for the spell check webservice but how to connect sms sender on a phone with the spell checker :( Maybe we can create own SMSsender and let it check the text... I'll try to come up with an idea when I'll have more time.

Posted by Lukas on September 21, 2005 at 06:52 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This is the main channel to share news, tips and other stuff related to my work. Sometimes you can find even personal stuff. Enjoy your reading...

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
news
Blogroll

No bookmarks in folder

OldNews
MyTrash
NavBar
NetBeans
LinksToBeExpanded