| 1 |
EJBs as Web Services |
| 2 |
===================== |
| 3 |
|
| 4 |
Two beans are defined here. |
| 5 |
|
| 6 |
SimpleBeanEJB is a straightfoward adaptation of everybody's favourite: |
| 7 |
the HelloWorld routine. |
| 8 |
|
| 9 |
NiceThingsBeanEJB is a demonstration of using complex types. It uses NiceThings objects - each NiceThings object holds a person's favourite food, colour and lucky number. |
| 10 |
|
| 11 |
Look in the ant build.xml file. The most relevant tasks are: |
| 12 |
|
| 13 |
* deployejb: Compiles and deploys the ejbs. You will need to alter the deploy.dir parameter; you may also need to add vendor-specific configuration in the META-INF directory in order to be able to deploy |
| 14 |
the ejbs. |
| 15 |
|
| 16 |
* deployws and undeployws: Deploy and Undeploy the web services respectively. |
| 17 |
|
| 18 |
* simplebean and nicethingsbean: Generate wsdl files for each of the services respectively, Ant needs to find the ejb classes to do this - the easiest way to do this is to put wsejbsample.jar in your classpath |
| 19 |
|
| 20 |
Additional targets added for simplebean |
| 21 |
|
| 22 |
* w2j: Runs Wsdl2Java on the generated WSDL in the previous step ("simplebean" target). |
| 23 |
|
| 24 |
* build-client: Compiles code generated by the previous step |
| 25 |
|
| 26 |
* run-junit: Runs the Junit test case generated by the w2j step, for invoking the webservice and the EJB method. |
| 27 |
|
| 28 |
|
| 29 |
Typical sequence of ant targets to run for testing simplebean example: |
| 30 |
|
| 31 |
deployejb |
| 32 |
deployws |
| 33 |
j2w-simplebean |
| 34 |
w2j-simplebean |
| 35 |
build-client |
| 36 |
run-junit |
| 37 |
|
| 38 |
|
| 39 |
|