[jboss-user] [JBoss Tools] - How to Proxy A Web Service with SOA-P 5 in JBDS

Administrator Administrator do-not-reply at jboss.com
Mon Jan 24 09:52:11 EST 2011

Administrator Administrator [http://community.jboss.org/people/admin] modified the document:

"How to Proxy A Web Service with SOA-P 5 in JBDS"

To view the document, visit: http://community.jboss.org/docs/DOC-15171

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  http://www.redhat.com/docs/en-US/JBoss_SOA_Platform/5.0.0/html-single/Programmers_Guide/index.html 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  http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory Apache Commons HTTPClient http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory  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://community.jboss.org/docs/DOC-14036 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:// 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.

 http://community.jboss.org/servlet/JiveServlet/showImage/2552/esb1.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2552/esb1.png 

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.

 http://community.jboss.org/servlet/JiveServlet/showImage/2553/esb2.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2553/esb2.png 

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.

 http://community.jboss.org/servlet/JiveServlet/showImage/2554/esb3.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2554/esb3.png 

Step 4: Name the HTTP Provider

 http://community.jboss.org/servlet/JiveServlet/showImage/2555/esb4.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2555/esb4.png 

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

 http://community.jboss.org/servlet/JiveServlet/showImage/2556/esb5.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2556/esb5.png 

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

 http://community.jboss.org/servlet/JiveServlet/showImage/2557/esb6.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2557/esb6.png 

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

 http://community.jboss.org/servlet/JiveServlet/showImage/2558/esb7.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2558/esb7.png 

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

 http://community.jboss.org/servlet/JiveServlet/showImage/2559/esb8.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2559/esb8.png 

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

 http://community.jboss.org/servlet/JiveServlet/showImage/2560/esb9.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2560/esb9.png 

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.

 http://community.jboss.org/servlet/JiveServlet/showImage/2561/esb11.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/2561/esb11.png 

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.

 http://community.jboss.org/servlet/JiveServlet/showImage/102-15171-6-2565/esb14.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15171-6-2565/450-328/esb14.png 

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.

 http://community.jboss.org/servlet/JiveServlet/showImage/102-15171-6-2566/esb12.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15171-6-2566/450-316/esb12.png 

 http://community.jboss.org/servlet/JiveServlet/showImage/102-15171-6-2567/esb13.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15171-6-2567/450-316/esb13.png 

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.

 http://community.jboss.org/servlet/JiveServlet/showImage/102-15171-6-2568/esb15.png  http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15171-6-2568/450-328/esb15.png 

Just a few notes on Performance tuning.  Please review the guide on  http://www.redhat.com/docs/en-US/JBoss_SOA_Platform/5.0.1/html/Administration_Guide/chap_PerformanceTuning.html 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  http://www.redhat.com/docs/en-US/JBoss_SOA_Platform/5.0.1/html/Programmers_Guide/chap-SOA_ESB_Programmers_Guide-Out-of-the-box_Actions.html#sect-SOAP-SOAPPROXY 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/httpclient.properties" />

Here is an example of the httpclient.properties 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.

Comment by going to Community

Create a new document in JBoss Tools at Community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110124/d5452f5f/attachment-0001.html 

More information about the jboss-user mailing list