The soap-binding example aims to demonstrate how one can use the Servicemix-http and servicemix-jsr181 components to invoke a pojo object as a web service over HTTP.

Here is a breakdown of what happens when you hit the 'send' button on the client.html page.

  1. When send button is clicked, a javascript function(send()) is invoked.
  2. The javascript function submits an Ajax request to the http endpoint deployed using the serviceunit(binding-su.zip) on the Servicemix-http component.The soap request present in the textfield on the left hand side(see circled content in the above image) is sent a parameter to Ajax request.
  3. The Httpendpoint receives the http+soap request and sends the request to the 'proxied' pojo endpoint(proxied endpoint reference configuration is shown in the xbean.xml excerpt below) deployed using engine-su.zip over the NMR.
    Here is the excerpt from the xbean.xml file under
    [Serivemix installation directory]\servicemix-3.0-M1\examples\soap-binding\src\components\soap
    <http:endpoint service="demo:simple-service"
    				         endpoint="simple-service"
    	               role="consumer"
    	               locationURI="http://localhost:8192/Service/"
    	               defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                     soap="true" />
    
  4. The servicemix-jsr181 receives the request from the NMR and invokes the 'SimpleService' pojo' 'ping' method.
  5. The 'SimpleService' returns the response to the 'ping' method and servicemix-jsr181 sends to response back the Httpendpoint over the NMR.
    Here is the excerpt of the implemenation for the ping method
    SimpleService.java
    public PingResponse ping(PingRequest request)
    {  PingResponse response = new PingResponse();  response.setMessage("Ping: " + request.getMessage());  return response;  }
    
    This method prefixes a "Ping:" to request recieved and sends it back as the response
  6. The Servicemix-http sends the response back the browser instance from which the ajax request was sent.
  7. The browser invokes java script function that sets the response field value to the response received.

There are some subtle points to note here

  1. The proxied endpoint is configured using the service="demo:simple-service" and endpoint="simple-service" attributes in the http:endpoint configuration in the binding-su's xbeans.xml file. The values demo:simple-service and simple-service point to service name and endpoint name of the pojo endpoint configuration( service="demo:simple-service" endpoint="simple-service" attributes of jsr181:endpoint configuration) in engine-su's xbean.xml file.
  2. The Servicemix-http and servicemix-jsr181 components are installed at runtime and not using the servicemix.xml file under [servicemix-home]\examples\soap-binding folder.
  • No labels