Thursday, April 17, 2008

Apache AXIS with IBM's WSAD/RAD

All major IDEs from different Vendors support webservices using Apache Axis.In this post my objective is to demonstrate a simple web service development and deployment using IBM's Websphere Application Developer(WSAD)/Rational Application Developer(RAD).They both provide support for Apache Axis and can use Axis libraries as required for runtime environment for web services.

In following heads all the steps involved are explained:

Configure Axis as runtime for Web services in RAD

-Start RAD/WSAD. Open a new workspace, and close the welcome screen.
-In WSAD/RAD,go on menu, Window >Preferences >Web Services >Server and Runtime
Do the settings for Apache Axis runtime as shown in the Figure 1.



Figure 1



Create a new Web Project

Now we have a plain java class and a web project. Next step is to create a web service out of this class and embed it into this Web project
-Switch to J2EE perspective, and create a new Dynamic Web project with name 'AxisExample'.


Figure 2

Create a simple java class which you want to expose as a web service.


Figure 3

Write any method which you want to access through WebService

Figure 4

Now you have a simple java class and a web project. The next step is to create a web service out of this class and embed it into this Web project.

For creating Web Service switch to J2EE Perspective



Figure 5


Select wizard to create a Web Service


Figure 6

Select Web Service type as desired (in this case select Java Bean Web Service)

Figure 7
Select the class created earlier as Java bean


Figure 8


If you select to generate proxy then the wizard will also ask you to select client type, for which proxy is to be generated



Figure 9


In this step you may have to manually select Axis as runtime if not default selected. And also you have to select the Web project just created as service project and also the server instance on which you want deploy this Web Service

On clicking next, a warning will pop up Ignore this warning, this is because RAD uses an older version of axis.

Figure 10


Now we are ready to generate and deploy the web service !

Figure 11


If you want to test this service, click on launch in next screen.



Figure 12


And you get the output as shown in the figure 13 in web-browser


Figure 13


Now let us generate proxy for this web service through wizard


Figure 14


Select the methods you want to add in the proxy generated


Figure 15

Generated Proxy Classes when you view them in J2EE perspective



Figure 16

Testing through browser




Figure 17

WSDL file generated by axis. This is visible at https:// <web service uri>?wsdl





Figure 18

Test Client using Generated Proxy



Figure 19

Test Client using Axis API



Figure 20

Labels: , , , ,

1 comments :

Anonymous said...

Good example on how to turn a simple class into a web service. But can someone please explain the steps on how to create a simple form.html for invoking this web service!! In other words, apart from the creation of this *.html file, what other existing file(s) need to be altered/or created? Thanks in advance

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker