Sambuca Simple Web Service Framework - Running the Simple Echo Web Service

Navigation

Running the Simple Echo Web Service using the Web Service Auto Mounter Server

  1. Make sure the Sambuca JAR is in your classpath ([SAMBUCA_INSTALL_DIR]/bin/sambuca.jar). From the command line you can run [SAMBUCA_INSTALL_DIR]/cmd/setenv.bat from Windows to automatically set your classpath for the current command line session only.
  2. Run the com.roguelogic.sambuca.websrvcs.simple.WebServiceAutoMounter class. You can run [SAMBUCA_INSTALL_DIR]/cmd/SimpleEchoWebService.bat from Windows to start the WebServiceAutoMounter using the default command line arguments: com.roguelogic.sambuca.websrvcs.simple.SimpleEchoWSFacade 8181. This batch file will not set the optional system properties. See Usage below for more information.
  3. Usage of the Web Service Auto Mounter:
    java <-DSambucaLogger=[CLASS_NAME]> com.roguelogic.sambuca.websrvcs.simple.WebServiceAutoMounter [WEB_SERVICE_FACADE_CLASS_NAME] [PORT]
    Where [WEB_SERVICE_FACADE_CLASS_NAME] is the fully qualified class name of a java Facade, that the WebServiceAutoMounter will scan and make available ALL public methods of this class as Web Services via the supplied [PORT].
  4. Example: $JAVA_HOME/bin/java -cp /home/user/sambuca/bin/sambuca.jar com.roguelogic.sambuca.websrvcs.simple.WebServiceAutoMounter com.roguelogic.sambuca.websrvcs.simple.SimpleEchoWSFacade 8181
  5. To browse the Web Service Inventory XML descriptor, from a browser if you started your server on port 8181 enter the URL: http://localhost:8181/?action=GET-WS-INVENTORY.

Building the Client Stubs for the SimpleEchoWSFacade Web Service

  1. Make sure the WebServiceAutoMounter server is running on your local machine.
  2. Make sure the Sambuca JAR is in your classpath ([SAMBUCA_INSTALL_DIR]/bin/sambuca.jar). From the command line you can run [SAMBUCA_INSTALL_DIR]/cmd/setenv.bat from Windows to automatically set your classpath for the current command line session only.
  3. Run the com.roguelogic.sambuca.websrvcs.simple.ClientStubGenerator class. You can run [SAMBUCA_INSTALL_DIR]/cmd/GenerateSimpleEchoWSClient.bat from Windows to start the ClientStubGenerator using the default command line arguments: http://localhost:8181/?action=GET-WS-INVENTORY com.roguelogic.tests ../tests.
  4. Compile the generated class: SimpleEchoWSFacadeWSClient.java using javac or your favorite IDE (Make sure sambuca.jar is in your classpath when compiling!). You can also use the CompileTestSimpleEchoWS.bat to compile from the Sambuca Install directory.

Running the test client for SimpleEchoWSFacade against the WebServiceAutoMounter server

  1. Make sure the WebServiceAutoMounter server is running on your local machine.
  2. Make sure the Sambuca JAR is in your classpath ([SAMBUCA_INSTALL_DIR]/bin/sambuca.jar). From the command line you can run [SAMBUCA_INSTALL_DIR]/cmd/setenv.bat from Windows to automatically set your classpath for the current command line session only.
  3. Make sure you generated and compiled the client stubs for SimpleEchoWSFacade using the instructions above.
  4. Compile the included test client class in the [SAMBUCA_INSTALL_DIR]/tests directory. The java file is: TestSimpleWSEcho.java in package com.roguelogic.tests. Make sure sambuca.jar is in your classpath as well as the client stub "SimpleEchoWSFacadeWSClient" you already generated and compiled.
  5. Run the com.roguelogic.tests.TestSimpleWSEcho passing the url to the WebServiceAutoMounter running with SimpleEchoWSFacade. Example: java com.roguelogic.tests.TestSimpleWSEcho http://localhost:8181/ (Or you can run the [SAMBUCA_INSTALL_DIR]\cmd\TestSimpleEchoWS.bat file on windows.)


RogueLogic