Note: The current release is NetBeans IDE 6.5. If you are using NetBeans IDE 6.5, see the latest version of this tutorial.
When you deploy a web service to an application container, the IDE lets you test the web service to see if it functions as you expect. The Tester application, provided by GlassFish, is available from the IDE for this purpose.
In this tutorial, you begin by creating an enterprise application. After you add the EJB module and the web service to the enterprise application, you deploy them together, as one unit, by deploying the enterprise application.
Tutorials In This Trail
In the following procedure, you create a web application containing both the EJB module and the web service you created in earlier tutorials. After you deploy the application, you can use it to test the web service.
To test the web service:
Click Next. The Name and Location page opens.
In the Project Name field, type FlowerApplication. Select the location you want for this project—use the same location for the other projects you create for the end-to-end application. Keep the default settings for the other options and click Next. The Server and Settings page opens.
Select the application server and Java EE version. This must be the same for all projects in the end-to-end application. Make sure to deselect the Create EJB Module checkbox and the Create Web Application Module checkbox, because you do not want to create new modules. You now see the following in the wizard.
Click Finish. A new enterprise application is added to the IDE. Now we need to add our two modules to the application.
Right-click the FlowerApplication Java EE Modules node and choose Add Java EE Module, as shown below.
The Add Java EE module dialog opens. Choose both the FlowerAlbum and FlowerService modules and click OK. You should now see that the two modules are added to the application, as shown below.
Right-click the FlowerApplication node and choose Properties from the context menu. Choose Run from the categories. Type /FlowerService?Tester in the Relative URL field, as shown here, and click OK.
Right-click the FlowerApplication node. From the context menu, select Run. If the server is not running, the IDE will start it. Then it will deploy the application, containing our two modules, to the server. Next, because of the settings specified in the previous dialog, the browser will open and display the Tester application, shown below.
Once you see the Tester application, open the Services window in the IDE, expand the Servers node, and notice that the IDE added new nodes for the deployed application and its modules, as shown here.

You now know for sure that the application has been successfully deployed.
Click WSDL File in the Tester application and notice that the browser now shows the WSDL file.
Above, the browser shows, among other things, the location of the schema. Type or paste the URL of the schema in the browser and the schema file appears.
Return to the Tester window. Type the name of one of the images, such as "rose", in the Tester application. Click the getFlower button and the IDE shows you information about the invocation in the browser.
When you look at the "Method Returned" above, you see that it is garbled. You want to see an image, not a series of symbols. However, since java.awt.Image is not a valid schema type, you need to manually configure the schema file to return binary image/jpeg data. You will do this in the next tutorial.
Modifying the Schema and WSDL Files to Pass Binary Data
To send comments and suggestions, get support, and keep informed on the latest developments on the NetBeans IDE Java EE development features, join the mailing list.
You are viewing a mobilized version of this site...
View original page here