Friday, February 16, 2007

Web Service at JRun 4

Would like to share my way of developing web service & testing it at JRun4 Web Server. I assume you know the concept of web service as this tutorial is specific to web service running on JRun web server. Also i assume you have already known how to use the Eclipse Web Service function which allows you to generate web service related files within a few seconds.

  1. To publish a web service at JRun 4 is very simple, what you need to do is to only create the "wsdd"(web service deployment descriptor) file and place it under your "PROJECT_HOME/WEB-INF/" folder.
  2. Start JRun server for your project. Create WSDL file by just running your project's web service's URL appended with '?WSDL'. For e.g (http://localhost:8103/services/ProgramWs?WSDL). For this case, "http://localhost:8103/services/ProgramWs" is the path to test the validity of web service ProgramWs.
  3. Using the generated WSDL file, go to command prompt, go to your WSDL location, run this command (before that, make sure that you have set JRUN_HOME/bin to your environment path) wsdl2java xxx.wsdl d:/ where xxx.wsdl is your wsdl file while d:/ is the output directory of the generated java classes. Thus, the bean object will be generated. What you need to do now is to replace your original bean object with it. For e.g. Your web service is about to get all programs of an institution, you will have a "getPrograms()" method which returns an array of Program bean object. So just replace this Program object with the auto-generated one which contains additional code for the web services.

No comments:

Post a Comment