Web Service With EJB Backend component
This example shows how to wirte a web service with stateless EJB
backend component.
Steps involved in writing this example:
- Write the value types -
World.java
- Write backend EJB classes -
HelloWorldService.java
HelloWorldHome.java
HelloWorldService.java
- Write EJB DD files
ejb-jar.xml and
weblogic-ejb-jar.xml
- Write ant build file to compile and build the service.
build.xml
build-webss.xml
Build EJB:
- compile java files to output directory
- copy EJB DD files to output/META-INF
- jar up output dir
- run ejbc on this jar to get ejb jar (HelloWorldService.jar)
Build web service
- copy ejb jar to WEB-INF/lib directory
- run autotype to generate the codecs for the non build in types
- run source2wsdd to generate web-services.xml deployment
file and WSL file
- put the DD file in output/WEB-INF/ directory
- run clientgen on the WSDL file to generate the client jar
- jar up output directory as a war file
Build ear
- copy application.xml file to output/META-INF
- copy ejb jar and war file to output/META-INF
- jar up output as an ear file
Compile client
- compile the client side code
Main.java
- deploy the applicaiton by copying the war file into the
applications directory of the server
- Follow the instructions here
to build, run and test the service.