Example: Using a Sample Client to Connect to the ESP Web Services Provider for SOAP

Use the files in the %ESP_HOME%\examples\java\wspexample directory to run a sample client to connect to the ESP Web Services Provider for SOAP.

Prerequisites
Task
  1. Use the esp_wsp.bat or esp_wsp.sh script in %ESP_HOME%\wsp to start the JETTY server and initialize the SOAP port.
  2. Access the ESP Web Service Provider WSDL through http://localhost:<port_number_specified_in_configuration>/espws/services/ESPWebService?wsdl.
  3. Use the %ESP_HOME%\examples\java\wspexample\project\timeccl.ccl file to create a new project in the ESP Studio.
  4. Double-click the project configuration file (timeccl.ccr) to open the CCR Project Configuration editor.
  5. Select the Advanced tab.
  6. Set the value of the Web Service Enabled option to true in the Project Deployment Details window.
  7. Save the updated ccr file.
    The timeccl.ccr file now has an entry, <Option name="ws-enabled" value="true"/>, to show that Web service accessibility is enabled.
  8. If the project is started, for the changes to take effect, use Studio or esp_cluster_admin to stop and remove the project from the node, then redeploy (add) the project. Or restart the cluster on which the project runs.
  9. Run the example com.sybase.esp.wsp.example.WSPExample from the %ESP_HOME%\examples\java\wspexample\src directory.
    Windows:
    java -cp .;%ESP_HOME%\libj\esp_sdk.jar;..\libs\axis.jar;..\libs\jaxrpc.jar;..\libs\commons-discovery-0.2.jar;..\libs\commons-logging-1.1.jar;..\libs\commons-lang-2.6.jar com.sybase.esp.wsp.example.WSPExample
    UNIX:
    java -cp .:$ESP_HOME/libj/esp_sdk.jar:../libs/axis.jar:../libs/jaxrpc.jar:../libs/commons-discovery-0.2.jar:../libs/commons-logging-1.1.jar;../libs/commons-lang-2.6.jar com.sybase.esp.wsp.example.WSPExample
  10. Check the ESP Studio to see the records get published to the InputWindow1 window using the Web services interface.
  11. Read the com.sybase.esp.wsp.example.ESPExample.java file and extend or write your own test cases accordingly.
  12. Compile updated code:
    javac -cp .;%ESP_HOME%\libj\esp_sdk.jar;..\libs\axis.jar;..\libs\jaxrpc.jar;..\libs\commons-discovery-0.2.jar;..\libs\commons-logging-1.1.jar;..\libs\commons-lang-2.6.jar com/sybase/esp/wsp/example/WSPExample.java
    Here are functions provided with the ESP Web Service Provider:
    • getVersion - obtain the version and last updated date for the ESP Web Services Provider
    • getSchema - obtains the schema string for the ESP project of your interest
    • publish - publishes stream data to an ESP project
    The publish function only accepts incoming data row in these formats:
       &lt;InputWindow1 ESP_OPS=&quot;i&quot; C_KEY=&quot;0&quot;
    C_TIMESTAMP=&quot;1970-01-01 12:12:00.000&quot; /&gt;
    	&lt;InputWindow1 ESP_OPS=&quot;u&quot; C_KEY=&quot;1&quot;  
    C_TIMESTAMP=&quot;1970-01-01 12:12:00.000&quot; /&gt;
    The rows above are escaped forms for these ESP XML format records:
    <InputWindow1 ESP_OPS="i" C_KEY="0" C_TIMESTAMP="1970-01-01 12:12:00.000" >
    <InputWindow1 ESP_OPS="u" C_KEY="1" C_TIMESTAMP="1970-01-01 12:12:00.000" >