By lukas on Nov 15, 2007
In previous versions of the IDE - 5.0, 5.5, 5.5.1 - the wizard generated even a sample MIDlet that provided a basic usage of the stub. It just took the parameters and showed the return values from the web service. There was lot of restrictions and problems with the sample MIDlet. Therefore the development team decided to drop the feature in NetBeans Mobility 6.0.
The usage of the generated stubs is really easy. IMO, the sample MIDlet might be nice for demo purposes however for the real work it's easier to create the MIDlet from scratch. I'll try to briefly show how to use the generated stubs in visual MIDlet. The sample mobile application is attach. I attached also the web project with the web service.
When you want to use the Java ME Web Service Client wizard you need to have the NetBeans Mobility IDE installed. The wizard isn't part of the standard mobility distribution however you can get it from update center. Look at my post "Where is the End2End functionality of Mobility Pack".
The Java ME Web Service Client wizard generates the stubs for you. You just have to point it to the WSDL file of the web service. You can either provide URL or browse for a wsdl on your hard drive. The wizrd parses and validates the WSDL file. When the web service is WS-I compliant and follows up the JSR 172 restrictions you are able to generate the stubs into a mobile project in the IDE.
When you have the stubs then you just use then in your application. It's very easy. In my case there is only one method public String sayHello(final String name) provided by the web service class HelloWS. The generated stubs class HelloWSService_Stub provides method public String sayHello(String name). Therefore the usage in your mobile application could be
HelloWSService stub = new HelloWSService_Stub(); //create the stub String result = stub.sayHello("Lukas"); //call the WS methodLook at the attached mobile project how to build up visual MIDlet with Mobile Visual Designer of Mobility Pack. It show the usage of the WaitScreen, Task, and other components provided by the NetBeans Mobility IDE 6.0.