Version 6

    A common question is how to Proxy  a Web Service with SOA-P 5 or the JBoss ESB with the help of JBDS (JBoss Developer Studio).  With SOA-P 5, several options are available to either call out to a Web Service or Host a Web Service internally.  We will be discussing only the new SOAPProxy, the other main options are HTTP Router, SOAP Processor and SOAP Client, if you are interested these additional options, please consult the SOA-P 5 Programmer's Guide. The new SOAPProxy is very useful in consuming an external Web Service implemented in anyway (i.e., C, C++, .NET or PHP), and republishing it with the SOA Platform. In this article, We will just be proxying the Web Service,  not touching on the more interesting use cases, such as Versioning, adding Client Service Contracts, Aggregation, Orchestration, Transformations or Content Based Routing.  These use cases and more can be built once we have the base foundation for proxying as laid out in this article.


    In using SOAPProxy, first thing that you'll need is a wsdl.  You can have this as a file or as a remote end point.  A file is preferred to avoid dependency on the remote systems availability. When using a wsdl added to the file system, you can point to it by using the classpath, like this classpath:///META-INF/order.wsdl(yes, that is 3 slashes).  When using SOAPProxy, HTTPS and associated credentials can be added. An Apache Commons HTTPClient properties file can be included to setup SSL with the Web Service endpoint.  The Apache HTTPClient properties can also be used for Performance tuning settings, this is discussed at the end of this article.


    As input to the SOAPProxy Action, a HTTP Gateway should be the defined listener.  An important feature of the HTTP Gateway is its ability to decode client requests and send the response back in the same requesting context-type. When HTTP Gateway is used with an HTTP Provider, Protected Methods and Allowed Users can be utilized in conjunction with the HTTP Gateway.  In addition, you can add a transport guarantee (ie, require HTTPS). The HTTP Gateway uses a servlet in the implementation, it does not need an extra port to listen on, it will use the same port that the ESB is listening on (ie, 8080).  The path to the servlet is http://<host>:<port>/<esbname>/http/<URL Pattern>, you have the option of choicing the URL Pattern in the HTTP Gateway definition, you don't have to define it.



    Now without any further ado, let's start up the JBoss Developer Studio 3.0, as a prerequisite you need a Web Service Project or an external Web Service available.


    Step 1: Create a ESB Project, from the projects menu search for esb to find it, instead of looking thru the categories.




    Step 2: Name the project, and define the ESB Runtime.  Although you will be using SOA-P5, the ESB version is 4.7, it should default to that version.  If not, you may not have JBDS 3.0. Also, SOA-P 5 uses EAP 5.0 as its runtime.




    Step 3: At this point, the ESB Editor should be in the middle of the screen.  This editor allows you to add most of the jboss-esb.xml functionality by point and clicking.  We are going to start by adding a HTTP Provider in Step 4, so find the Providers section and right click New and then HTTP Provider.




    Step 4: Name the HTTP Provider




    Step 5: Name a Channel which will be referred to by the HTTP Gateway in the subsequent steps.




    Step 6: Add a Service with a category and description.




    Step 7: Add Global as the inVM parameter, this means that the service can be invoked in the same classloader.




    Step 8: Add the HTTP Gateway and select the channel defined earlier from the select drop down list.




    Step 9: In the URL Pattern box, pick a path for your service to be called by external clients.




    Step 10: In the Actions section, right click and then Actions->Web Services ->SOAP Proxy

    Here we specify an external wsdl or bring it in local to avoid external dependencies on startup.




    Step 11: Make sure the WSDL is located in the file location specified. Here we are using the META-INF folder as our WSDL location.




    Step 12: Start the server and add the ESB Project to the server.  At this point, any changes can be updated with a Publish from the Server tab.






    Step 13: With the server up and runing, open your favorite SOAP testing tool(SoapUI is used here), and add the Message body and verify that the ESB is accepting the message and proxying correctly.




    Just a few notes on Performance tuning.  Please review the guide on Performance Tuning.  There are some specific recommendations that will greatly improve your Performance with SOAPProxy. First, the the maxthreads for the service can improve the throughput under heavy load.  Second, the HTTPClient Properties should be added to the SoapProxy, this is discussed in the ESB Programmer's Guide of SOA-P 5.0.1.  You can not add these via the ESB Tooling in JBDS 3.x.  However, you can add these properties by viewing in the Source View, instead of the Tree view by clicking on the tab.  Here is an example:


    <service category="WS Proxies" description="A Order Web Service Proxy"
       invmScope="GLOBAL" name="myService">
       <property name="maxThreads" value="100"/>
        <http-gateway busidref="myChannel" name="myHTTPGateway" urlPattern="/order"/>
        <action name="myProxy">
         <property name="wsdl" value="classpath:///META-INF/order.wsdl"/>
         <property name="file" value="/META-INF/" />



    Here is an example of the that We have seen better throughput for high load Performance Tests:



    # Connection config




    That's it! You are now ready to implement more Business Specific Use Cases with this Web Service Proxy as a base.