tag:blogger.com,1999:blog-80486077940056516082024-03-13T22:36:44.195-07:00JBossESBThis is the blog site for the JBossESB team. Although we will predominately concentrate on the JBossESB project, expect entries on ESB and SOA concepts in general.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.comBlogger77125tag:blogger.com,1999:blog-8048607794005651608.post-52265544059048665632012-03-22T17:54:00.002-07:002012-03-22T17:59:41.330-07:00Win a Free Copy of the JBoss ESB Beginner’s Guide<div style="font-family: inherit;">
</div>
<div style="font-family: inherit;">
</div>
<div style="font-family: inherit; margin-bottom: 0in;">
<span style="font-size: medium;">Hey
everyone – Packt Publishing just announced a contest for (3) lucky followers of this blog to win a free e-copy of </span><a href="http://link.packtpub.com/rU3wQJ"><span style="font-size: medium;"><b>JBoss
ESB Beginner’s Guide</b></span></a><span style="font-size: medium;">.
</span>
</div>
<div style="font-family: inherit; margin-bottom: 0in;">
<br /></div>
<div style="font-family: inherit; margin-bottom: 0in;">
<span style="font-size: medium;">Keep
reading to find out how you can be one of the Lucky Winners.</span></div>
<div style="font-family: inherit; margin-bottom: 0.02in; margin-top: 0.02in; orphans: 2; widows: 2;">
</div>
<div style="font-family: inherit; margin-bottom: 0in;">
<br /></div>
<div style="font-family: inherit; margin-bottom: 0in;">
<span style="font-size: medium;">With
the JBoss ESB Beginner’s Guide, you can learn how:</span></div>
<div style="font-family: inherit; margin-bottom: 0in;">
</div>
<ul style="font-family: inherit;">
<li><div style="margin-bottom: 0in;">
<span style="font-size: medium;">To
Develop your own service-based applications, from simple deployments
through to complex legacy integrations</span></div>
</li>
<li><div style="margin-bottom: 0.02in; margin-top: 0.02in; orphans: 2; widows: 2;">
<span style="font-size: medium;">Services can communicate
with each other and the benefits to be gained from loose coupling in
a Service Oriented Architecture</span></div>
</li>
</ul>
<div style="font-family: inherit; margin-bottom: 0.02in; margin-top: 0.02in; orphans: 2; widows: 2;">
<span style="font-size: medium;">You can read more about this
book and download a free sample chapter here:
<a href="http://link.packtpub.com/rU3wQJ">http://link.packtpub.com/rU3wQJ</a></span></div>
<div style="font-family: inherit; margin-bottom: 0.02in; margin-top: 0.02in; orphans: 2; widows: 2;">
<br /></div>
<div style="font-family: inherit; margin-bottom: 0.02in; margin-top: 0.02in; orphans: 2; widows: 2;">
<span style="font-size: medium;"><b>How to Enter?</b></span></div>
<div style="font-family: inherit;">
</div>
<div style="font-family: inherit;">
<span style="font-size: medium;">Head on over to the <a href="http://link.packtpub.com/rU3wQJ">book
page</a> at Packt, read through the product description of this book and drop
us a line via the </span><span style="font-size: medium;"><b>comments
section stating what interests you the most about this book and
about JBoss ESB</b></span><span style="font-size: medium;">.
It’s that simple.</span> </div>
<div style="font-family: inherit;">
</div>
<div style="font-family: inherit;">
<span style="font-size: medium;">Here’s the product
description for the book: <a href="http://link.packtpub.com/rU3wQJ">http://link.packtpub.com/rU3wQJ</a></span></div>Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com16tag:blogger.com,1999:blog-8048607794005651608.post-23088974976643875252012-01-25T06:08:00.000-08:002012-01-25T07:00:21.619-08:00The JBoss ESB Beginner's Guide is officially published today!<br />
It's available at Packt now! <a href="http://www.packtpub.com/jboss-esb-beginners-guide/book">http://www.packtpub.com/jboss-esb-beginners-guide/book</a><br />
<br />
And at Amazon: <a href="http://www.amazon.com/JBoss-ESB-Beginners-Guide-DiMaggio/dp/1849516588/">http://www.amazon.com/JBoss-ESB-Beginners-Guide-DiMaggio/dp/1849516588/ </a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-fNJv5MO0HzA/TyALeZSbb8I/AAAAAAAAHeU/xZTbGIqvRok/s1600/JBossESBBookCover.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/-fNJv5MO0HzA/TyALeZSbb8I/AAAAAAAAHeU/xZTbGIqvRok/s320/JBossESBBookCover.jpg" width="259" /></a></div>
<br />
A review of the book is here: <a href="http://rickwagner.blogspot.com/2011/10/book-review-for-jboss-esb-beginners.html">http://rickwagner.blogspot.com/2011/10/book-review-for-jboss-esb-beginners.html</a>Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-10328601605445176812011-12-07T11:32:00.001-08:002011-12-07T11:35:17.407-08:00Packt Survey for JBoss Books - and a discountPackt, the folks publishing the JBoss ESB Begineers' Guide later on this month, have a new survey for JBoss users and books.<br />
<br />
The survey is here: <a href="http://snipurl.com/21212r0">http://snipurl.com/21212r0</a><br />
<br />
Packt is overseeing a community survey for JBoss users to find out what support they need to aid and enhance their JBoss experience. Packt want to make sure they are making the right offers to all JBoss users and are providing what they need and want.<br />
<br />
The survey is about all of JBoss projects (Drools, AS, jBPM and more). The questions will help to provide a snapshot of how the community finds support, how they self-educate, help each other and what information they need now.
As Packt think the results will be of genuine interest to the JBoss community, the results of the survey will be published.<br />
<br />
Not only that but every JBoss user that completes the survey will receive a 25% discount off their next JBoss eBook purchase from PacktLen DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com3tag:blogger.com,1999:blog-8048607794005651608.post-82732302495513962672011-09-29T20:08:00.000-07:002011-09-29T20:08:43.101-07:00JBoss ESB Book - in the Packt RAW ProgramAnd, the soon-to-be-published (by Packt) JBoss ESB Beginner's Guide is now in the Packt "RAW" program - so that the book can be purchased pre-release - and chapters are provided as they are completed.
<p>
<a href="http://www.packtpub.com/jboss-esb-beginners-guide/book">http://www.packtpub.com/jboss-esb-beginners-guide/book</a>
<p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.packtpub.com/sites/default/files/imagecache/productview/6587os_mockupcover_bg.jpg" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="151" width="125" src="https://www.packtpub.com/sites/default/files/imagecache/productview/6587os_mockupcover_bg.jpg" /></a></div>
Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-48907044295852331282011-09-12T17:23:00.000-07:002011-09-12T17:23:20.371-07:00The JBoss ESB Guide is on AmazonAnd - the soon-to-be-published book just appeared on Amazon:
<p>
<a href="http://www.amazon.com/JBoss-ESB-Beginners-Guide-DiMaggio/dp/1849516588">JBoss ESB Beginners Guide</a>Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-47246711517142399102011-08-18T11:33:00.000-07:002011-08-18T11:33:59.663-07:00JBoss ESB Beginner's Guide - Expected in NovemberPackt is publishing the "JBoss ESB Beginner's Guide" in November!<br />
<a href=" http://www.packtpub.com/jboss-esb-beginners-guide/book"><br />
http://www.packtpub.com/jboss-esb-beginners-guide/book</a><br />
<br />
Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-69032665610725209092011-07-08T08:03:00.000-07:002011-07-08T08:03:39.532-07:00ESB 4.10 ReleasedWe are happy to announce the 4.10 release of JBoss ESB. It is now available for download at our project site listed below. The major features of this release are as follows:<br />
<br />
<ul><li>Support for JBoss AS 6.0.0.Final</li>
<li>Drools 5.2.0</li>
<li>jUDDI 3.1.0 and the inclusion of the juddiv3.war</li>
<li>Scout 1.2.3</li>
<li>Smooks 1.4</li>
</ul><br />
and numerous bug fixes.<br />
<br />
The project site is updated with binaries and documentation:<br />
<br />
<a href="http://jboss.org/jbossesb/downloads.html">http://jboss.org/jbossesb/downloads.html</a><br />
<a href="http://jboss.org/jbossesb/docs.html">http://jboss.org/jbossesb/docs.html</a><br />
<br />
Thanks to everyone who contributed to this release for your hard work!David Wardhttp://www.blogger.com/profile/09048079707788175631noreply@blogger.com3tag:blogger.com,1999:blog-8048607794005651608.post-47860737446263376192010-02-24T17:52:00.000-08:002010-02-24T17:54:12.892-08:00Two JBossESB blog posts were just reposted to DzoneAnd, here they are:<br /><br />"From HTTP to the ESB - JBossESB 4.7's New Servlet based HTTP Gateway," <a href="http://architects.dzone.com/news/jbossesb-http-gateways">http://architects.dzone.com/news/jbossesb-http-gateways</a><br /><br />"Message Alerts in JBossESB 4.7," <a href="http://soa.dzone.com/news/messagealerts-jbossesb-47">http://soa.dzone.com/news/messagealerts-jbossesb-47</a>Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-33428748550213836482010-01-15T02:43:00.000-08:002010-01-15T03:05:34.818-08:00JBoss Tools Smooks Editor - Progress...<p>We've been making some good progress with the <a href="http://www.jboss.org/tools/" mce_href="http://www.jboss.org/tools/">JBoss Tools</a> Smooks Editor. The following are two rough Screencasts (audio is poorly edited... apologies) illustrating two use cases that extend from each other.</p> <h2><span style="font-size:180%;">EDI to Java</span></h2> <p>In this Screencast, we bind EDI Purchase Order data (but can also be XML, JSON etc) into an "Order" object model (Java). This Screencast was created a few weeks ago, using the v3.1.0.CR1 release of JBoss Tools.</p><ul><li><a href="http://www.screencast.com/t/NWZhOWUx">See Screencast</a><br /></li></ul><h2><span style="font-size:180%;">EDI to XML (via XSD)</span></h2> <p>In this Screencast, we extend the example shown in the above Screencast, applying a template to the "Order" object model to produce an XML Purchase Order. The XML Purchase Order is defined in an XML Schema (XSD), but you'll see how the editor makes it very easy to work with the XSD. This Screencast was created recently, using one of the <a href="http://www.jboss.org/tools/download.html" mce_href="http://www.jboss.org/tools/download.html">Nightly Builds of JBoss Tools</a>.</p><ul><li><a href="http://www.screencast.com/t/YTJlYTdhOTQt">See Screencast</a><br /></li></ul><h2><span style="font-size:180%;">Status</span></h2> <p>We are currently working towards the v3.1.0.CR2 release of <a href="http://www.jboss.org/tools/" mce_href="http://www.jboss.org/tools/">JBoss Tools</a>, which is due to be released in Feb (not sure of exact date). There are still a number of <a href="https://jira.jboss.org/jira/browse/JBIDE/component/12311840" mce_href="https://jira.jboss.org/jira/browse/JBIDE/component/12311840">issues</a> with the editor. We are working on these and will be resolving many of them for the 3.1.0.CR2 release.</p> <p>We have purposely restricted the 3.1.0 version of the editor:</p> <ol><li><b>Supported Use Cases</b>: <ul><li><i>Java Mapping/Binding</i>: Drag & Drop mapping/binding of XML, JSON, CSV and EDI data to Java.</li><li><i>CSV and XML Templating</i>: Drag & Drop templating of Java Mappings (see #1 above) to produce CSV or XML (XML via XSD or XML Sample).</li></ul> </li><li><b>Supported Integration</b>: <ul><li><i>JBoss Tools ESB Editor</i>: Will have basic open and edit integration with the ESB SmooksAction.<br /></li></ul> </li><li><b>Supported Versions</b>: <ul><li><i>Smooks v1.2 Configurations</i>: The Editor will only support Smooks v1.2 configuration namespaces. Therefore, if you have configurations using config namespaces from earlier (or newer v1.3) versions of Smooks, the editor will not open the configurations.</li></ul> </li></ol> <p>So, the editor will not support:</p> <ol><li>Direct Source to Result drag & drop templating e.g. XML to XML, EDI to XML, XML to CSV etc. We hope to support this in a future release (next one hopefully), but for now (in the v3.1.0 release), you need to define a Java Object model to use as the canonical form of the data being mapped i.e. v3.1.0 templating works as <i>Source -> Java -> Result</i>.</li><li>A number of features supported by the Smooks Runtime, such as Persistence, Validation etc. We will be adding support for these in future releases.</li><li>Smooks v1.1 (and before) configuration namespaces that have newer versions in Smooks v1.2. For example, Smooks v1.2 added a v1.2 javabean config namespace. It is this version of the javabean config namespace that is supported by the editor. The v1.1 javabean config namespace is not supported.</li><li>Smooks v1.3 (yet to be released) configuration namespaces.</li></ol> <h2><span style="font-size:180%;">Try it Out...</span></h2> <p>Please take the editor for a spin and let us know what you think. It can be downloaded (standalone, or as part of <a href="http://www.jboss.org/tools/" mce_href="http://www.jboss.org/tools/">JBoss Tools</a>) from the <a href="http://www.jboss.org/tools/download.html" mce_href="http://www.jboss.org/tools/download.html">JBoss Tools Downloads Page</a>. <a href="https://jira.jboss.org/jira/secure/BrowseProject.jspa?id=10020" mce_href="https://jira.jboss.org/jira/secure/BrowseProject.jspa?id=10020">Please log any issues</a> you find with the editor (against the "smooks" component), if not already logged.</p>Tom Fennellyhttp://www.blogger.com/profile/14161465872732273475noreply@blogger.com0tag:blogger.com,1999:blog-8048607794005651608.post-8701060409791444672009-12-22T18:13:00.000-08:002009-12-22T19:09:24.132-08:00From HTTP to ESB - JBossESB 4.7's New Servlet based HTTP GatewayOne of the primary functions performed by JBossESB is the routing of messages between services. (Remember that, on an ESB, everything is either a message or a service.) The messages that JBoss ESB handles conform to org.jboss.soa.esb.message.Message. Service endpoints that can process messages in this format are described as being "ESB-aware." This is all well and good for services and applications that were designed and written with this message format in mind, but what about other services, including legacy applications, that communicate through other non-ESB aware data formats?<br /><br />JBossESB handles connecting services that communicate in non-ESB aware message formats through its gateway listeners. These listeners route incoming messages from outside the ESB to ESB services. The ESB's set of gateway listeners (generally referred to as "gateways") support a variety of message formats such as files, FTP, and JMS. These gateways accept messages in a non-ESB aware format onto the ESB and then convert them (actually, they wrap the message payload) into ESB-aware messages before sending them to their service's action pipeline.<br /><br />In this post, we'll take a look at JBossESB 4.7's new HTTP gateway ("http-gateway" ). <a href="#[1]">[1]</a><br /><br />You use an http-gateway to "expose" an ESB-unaware endpoint on the ESB. In other words, an http-gateway enables you to communicate to ESB services through HTTP endpoints, in the familiar format used by Java servlets. This servlet-based approach is made possible by the http-gateway leveraging the JBossESB Server or JBoss Application Server's HTTP container, just as any servlet would. This means that many of the HTTP configuration properties such as port addresses are already handled for you. You don't have to create the entire HTTP configuration for your http-gateway, as many configurations work right out-of-the-box. This is in keeping with other features of JBossESB, such as its rich set of out-of-the-box actions. <a href="#[2]">[2]</a><br /><br /><b>A Very Basic Example</b><br /><br />Let's take a quick look at a very basic http-gateway configuration. We'll take a longer look at variations of http-gateway usage later on in this post. To begin, let's start small. Here's a service definition taken from the JBossESB user guide <a href="#[3]">[3]</a> that you would create in your JBossESB application's jboss-esb.xml file:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Vehicles" name="Cars" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <http-gateway name="Http" /><br />4: </listeners><br />5: <actions mep="RequestResponse"><br />6: <!-- Service Actions.... --><br />7: </actions><br />8: </service><br /></code></pre>Like a lot of things with JBossESB, you can do a lot with a little. Let's examine this example line-by-line:<br /><ul><li>Line 1: Service name and category are used to differentiate the services. Every service has a category and name attribute. JBossESB uses these attributes to register a service's listeners (gateway listeners or ESB-aware listeners) endpoints in a service registry. The InVM transport enables services to communicate using the same JVM and without having to go through a second non-gateway provider. This makes things more efficient as the services don't have use any networking protocols between JVM instances. The "GLOBAL" value indicates that the this service can be invoked using the InVM transport using the same JVM.<br /></li><li>Line 3: Here's the definition of the http gateway.<br /></li><li>Line 5: Remember that since the gateway is servlet based, it requires a request/response message exchange pattern (or "mep" for short).<br /></li><li>Line 6: And, here's where the pipeline of actions would be defined.<br /></li></ul>Simple, right? Before we move on, did you notice what's not here? Dude, where's my service provider?<br /><br />Since a provider is not defined, the service uses a the ESB's default HTTP provider. And, since there is no bus reference ID (the busrefid element in a provider definition and then referenced elsewhere in jboss-esb.xml files), the ESB builds the HTTP endpoint that it exposes out of these fields:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: http://<host>:<port>/<.esbname>/http/Vehicles/Cars<br /></code></pre>The host and port number come from the ESB server. The "<.esbname>" token is the actual name of the deployed .esb archive, minus the .esb extension. Note that while this string is an HTTP URL, it's also an endpoint. The prefix of "http" is actually a namespace that is used for all the http-gateway endpoints.<br /><br />It's also important to note that the http-gateway listener captures all incoming HTTP requests that match the servlet mapping pattern expressed in the HTTP endpoint. You can make use of this mapping with the gateway's "urlPattern" property. For example, if we modify the service and gateway definition that we just looked at to include a urlPattern:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Vehicles" name="Cars" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <http-gateway name="Http" urlPattern="esb-cars/*" /><br />4: </listeners><br />5: <actions mep="RequestResponse"><br />6: <!-- Service Aactions.... --><br />7: </actions><br />8: </service><br /></code></pre>Then, the service's exposed HTTP endpoint would capture incoming HTTP requests at this address:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: http://<host>:<port>/<.esbname>/http/esb-cars/*<br /></code></pre><br /><b>Creating a Message From a Request</b><br /><br />How does the http-gateway actually convert an incoming HTTP request into an ESB message? It depends on the request's MIME type. What controls this is the “core:org.jboss.soa.esb.mime.text.types” configuration property. This property is defined in your server's jbossesb-properties.xml as a semi-colon separated list of character MIME types. The default value of the property includes wildcard support and is set equal to this set:<br /><br /> text/*<br /> application/xml<br /> application/*-xml<br /><br />The http-gateway uses this property to determine whether the request payload should be decoded into a Java String before it's given to the service, or if the payload should stay as a Byte array, and have the Service perform the decoding itself in an action. The http-gateway can also over-ride the default MIME type with the "payloadAs" attribute. This attribute enables you to have the gateway treat the payload as either “BYTES” or “STRING.” For text payloads, the gateway uses the same character encoding from the request.<br /><br />What about the other information in the incoming HTTP request?<br /><br />The request parameters are contained in the RequestParameterMap (a java.util.Map). These request query string parameters are stored as message properties on the ESB message created by the gateway. Full access to the URL arguments/query string is supported in that you can access the parameters in your service's actions by:<br /> <pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: Map params = (Map) message.getProperties().getProperty(“RequestParameterMap”);<br /></code></pre>The RequestInfoMap is another java.util.Map that contains request information such as authType, characterEncoding, HTTP Method, remoteHost, contentLength, etc.. You can access the parameters in your service's actions by:<br /> <pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: Map params = (Map) message.getProperties().getProperty(“RequestInfoMap”);<br /></code></pre>Let's switch gears now and look at a more extensive example.<br /><br /><b>The http_gateway Quickstart Example</b><br /><br />JBossESB release 4.7 includes the aptly named "http_gateway" quickstart example application. (As I always tell people, the quickstarts included with JBossESB are both a great learning tool and a great starting point for developing your own ESB applications.) The http_gateway quickstart demonstrates multiple ways of using the gateway to pass HTTP requests onto ESB services:<br /><ul><li>Basic authentication<br /></li><li>The default http bus<br /></li><li>Mapping ESB exceptions to HTTP error codes globally for an http-provider...<br /></li><li>...and how to over-ride that global setting<br /></li><li>Setting up an asynchronous response that changes the default response code<br /></li><li>Message-Level Security<br /></li></ul>We'll take these one at a time.<br /><br /><b>Basic Authentication</b><br /><br />The quickstart uses the "java:/jaas/JBossWS" security domain, which is already installed in JBoss ESB/App Server out-of-the-box configuration. The login username is "kermit" and the password is "thefrog". You can see this username/password combination defined in the "server/[server profile]/conf/props/jbossws-roles.properties" file. Let's take a look at the security setting in the quickstart's jboss-esb.xml file:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <globals><br />2: <!-- Security setting for all http-providers and all EBWSs in this jboss-esb.xml file.--><br />3: <war-security method="BASIC" domain="JBossWS" /><br />4: </globals><br /></code></pre>This "global" section is new with the http-gateway in JBossESB 4.7. Like the comment says, this defines the global security setting for all the http and EBWS providers in this application. The other supported settings for the war-security method are: DIGEST <a href="#[4]">[4]</a> and CLIENT-CERT.<br /><br />And here's the http-provider definition:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <http-provider name="http"><br />2: <http-bus busid="secureFriends"><br />3: <!-- Only users in the "friend" role are allowed<br />4: access via the "GET" method. Unspecified<br />5: methods are not protected (i.e. are allowed)... --><br />6: <allowed-roles><br />7: <role name="friend" /><br />8: </allowed-roles><br />9: <protected-methods><br />10: <method name="GET" /><br />11: <method name="POST" /><br />12: </protected-methods><br />13: </http-bus><br />14: <!-- Global exception mappings file... --><br />15: <exception mappingsFile="/http-exception-mappings.properties" /><br />16: </http-provider><br /></code></pre>In this file fragment we see:<br /><ul><li>Line 2: Here's where the http-bus definition starts. Note the name chosen for the busid ("secureFriends"). We'll reference this in the definition of the http-gateway in a moment.<br /></li><li>Line 5: The set of allowed roles starts here.<br /></li><li>Line 8: And the set of HTTP methods that user in the allowed roles can use is defined here. Note that the http-gateway supports using these HTTP methods: GET, PUT, POST and DELETE<br /></li><li>Line 14: Here's another global (global to the http-provider, that is) definition. We'll come back to the exception mappingsFile in a bit. This definition enables you to define status codes to be returned for exceptions.<br /></li></ul>Now, let's look at the actual http-gateway definition:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Sales" name="List" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/sales/* but will be forced to<br />4: authenticate because the "sales" bus has basic auth configured (above)... --><br />5: <http-gateway name="sales" busidref="secureFriends" urlPattern="sales/*" /><br />6: </listeners><br />7: <actions mep="RequestResponse"><br />8: <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/><br />9: </actions><br />10: </service><br /></code></pre>Here's where it all ties together:<br /><ul><li>Line 1: The service definition begins here. Note the "GLOBAL InVM scope that we talked about earlier.<br /></li><li>Line 5: The http-gateway definition is here. Note the reference to the busidref that we defined in the http-bus. Also note the urlPattern. We'll use this pattern when we run the quickstart.<br /></li><li>Line 6: The message exchange pattern (mep) is RequestResponse as, remember we're dealing with HTTP.<br /></li><li>Line 7: Our customer action. This class prints out informatin from the request.<br /></li></ul>OK - let's run the quickstart and see the results.<br /><br />Where's the client program that we run? Well, this quickstart is different from most of the other quickstarts in that you don't initial the test by generating a message. Remember how the http-provider we defined specified the GET and POST HTTP verbs? To run this part of the quickstart, you can just fire up your favorite browser and send an HTTP GET request by entering this URL:<br /><br /> http://localhost:8080/Quickstart_http_gateway/http/sales/a/b/c<br /><br />For the sake of illustration, we'll use the lynx (text) browser.<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source -auth=kermit:thefrog http://localhost:8080/Quickstart_http_gateway/http/sales/a/b/c<br />2: Service: Sales:List<br />3: <br />4: ------------Http Request Info (XStream Encoded)-------------------<br />5: <org.jboss.soa.esb.http.HttpRequest><br />6: <authType>BASIC</authType><br />7: <contextPath>/Quickstart_http_gateway</contextPath><br />8: <localAddr>127.0.0.1</localAddr><br />9: <localName>localhost.localdomain</localName><br />10: <method>GET</method><br />11: <pathInfo>/a/b/c</pathInfo><br />12: <protocol>HTTP/1.0</protocol><br />13: <remoteAddr>127.0.0.1</remoteAddr><br />14: <remoteHost>127.0.0.1</remoteHost><br />15: <remoteUser>kermit</remoteUser><br />16: <contentLength>-1</contentLength><br />17: <requestURI>/Quickstart_http_gateway/http/sales/a/b/c</requestURI><br />18: <scheme>http</scheme><br />19: <serverName>localhost</serverName><br />20: <requestPath>/http/sales</requestPath><br />21: <pathInfoTokens><br />22: <string>a</string><br />23: <string>b</string><br />24: <string>c</string><br />25: </pathInfoTokens><br />26: <queryParams/><br />27: <headers><br />28: <org.jboss.soa.esb.http.HttpHeader><br />29: <name>host</name><br />30: <value>localhost:8080</value><br />31: </org.jboss.soa.esb.http.HttpHeader><br />32: <org.jboss.soa.esb.http.HttpHeader><br />33: <name>accept</name><br />34: <value>text/html, text/plain, audio/mod, image/*, application/msword, application/pdf, application/postscript, application/x-java-jnlp-file, text/sgml, video/mpeg, */*;q=0.01</value><br />35: </org.jboss.soa.esb.http.HttpHeader><br />36: <org.jboss.soa.esb.http.HttpHeader><br />37: <name>accept-language</name><br />38: <value>en</value><br />39: </org.jboss.soa.esb.http.HttpHeader><br />40: <org.jboss.soa.esb.http.HttpHeader><br />41: <name>user-agent</name><br />42: <value>Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8e-fips-rhel5</value><br />43: </org.jboss.soa.esb.http.HttpHeader><br />44: <org.jboss.soa.esb.http.HttpHeader><br />45: <name>authorization</name><br />46: <value>Basic a2VybWl0OnRoZWZyb2c=</value><br />47: </org.jboss.soa.esb.http.HttpHeader><br />48: </headers><br /></code></pre><br /><b>The Default HTTP Bus in Action</b><br /><br />In the next part of the QuickStart we'll take another look a service definition where the <http-listener> definition doesn't reference a bus definition (busidref) and instead uses the "default" http bus. The definition of this service looks like this:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Index" name="List" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/index/*<br />4: Uses the default http bus configuration... --><br />5: <http-gateway name="Index" urlPattern="index/*" /><br />6: </listeners><br />7: <actions mep="RequestResponse"><br />8: <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/><br />9: </actions><br />10: </service><br /></code></pre><br />Well, there's not a great deal to look at here since the default http bus is being used. To access this service, you point your browser at this URL:<br /><br />http://localhost:8080/Quickstart_http_gateway/http/index/XXXX/yyy?a=1,b=2<br /><br />Note that we discussed earlier in this post and that this URL shows, we're able to process request parameters in the URL. Here's what lynx shows us:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source http://localhost:8080/Quickstart_http_gateway/http/index/XXXX/yyy?a=1,b=2<br />2: Service: Index:List<br />3: <br />4: ------------Http Request Info (XStream Encoded)-------------------<br />5: <org.jboss.soa.esb.http.HttpRequest><br />6: <contextPath>/Quickstart_http_gateway</contextPath><br />7: <localAddr>127.0.0.1</localAddr><br />8: <localName>localhost.localdomain</localName><br />9: <method>GET</method><br />10: <pathInfo>/XXXX/yyy</pathInfo><br />11: <protocol>HTTP/1.0</protocol><br />12: <queryString>a=1,b=2</queryString><br />13: <remoteAddr>127.0.0.1</remoteAddr><br />14: <remoteHost>127.0.0.1</remoteHost><br />15: <contentLength>-1</contentLength><br />16: <requestURI>/Quickstart_http_gateway/http/index/XXXX/yyy</requestURI><br />17: <scheme>http</scheme><br />18: <serverName>localhost</serverName><br />19: <requestPath>/http/index</requestPath><br />20: <pathInfoTokens><br />21: <string>XXXX</string><br />22: <string>yyy</string><br />23: </pathInfoTokens><br />24: <queryParams><br />25: <entry><br />26: <string>a</string><br />27: <string-array><br />28: <string>1,b=2</string><br />29: </string-array><br />30: </entry><br />31: </queryParams><br />32: <headers><br />33: <org.jboss.soa.esb.http.HttpHeader><br />34: <name>host</name><br />35: <value>localhost:8080</value><br />36: </org.jboss.soa.esb.http.HttpHeader><br />37: <org.jboss.soa.esb.http.HttpHeader><br />38: <name>accept</name><br />39: <value>text/html, text/plain, audio/mod, image/*, application/msword, application/pdf, application/postscript, application/x-java-jnlp-file, text/sgml, video/mpeg, */*;q=0.01</value><br />40: </org.jboss.soa.esb.http.HttpHeader><br />41: <org.jboss.soa.esb.http.HttpHeader><br />42: <name>accept-language</name><br />43: <value>en</value><br />44: </org.jboss.soa.esb.http.HttpHeader><br />45: <org.jboss.soa.esb.http.HttpHeader><br />46: <name>user-agent</name><br />47: <value>Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8e-fips-rhel5</value><br />48: </org.jboss.soa.esb.http.HttpHeader><br />49: </headers><br /></code></pre>Take special note of these lines:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <queryParams><br />2: <entry><br />3: <string>a</string><br />4: <string-array><br />5: <string>1,b=2</string><br />6: </string-array><br />7: </entry><br />8: </queryParams><br /></code></pre>Let's change the URL a bit and make sure that the query parameters can really be accessed by the service and its actions:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source http://localhost:8080/Quickstart_http_gateway/http/index/XXXX/yyy?param1=hello,param2=world<br />2: <br />3: <queryParams><br />4: <entry><br />5: <string>param1</string><br />6: <string-array><br />7: <string>hello,param2=world</string><br />8: </string-array><br />9: </entry><br />10: </queryParams><br /></code></pre>Yup! It's them!<br /><br /><span style="font-weight: bold;">A Global Exception</span><br /><br />In the description of the basic authentication example that we discussed earlier, we skipped over the definition of a global exceptions mapping for the http-provider:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <!-- Global exception mappings file... --><br />2: <<exception mappingsFile="/http-exception-mappings.properties" /><br /></code></pre>As its name indicates, this feature enables you to define a status code that will be returned for all requests that are received by a service. Let's take a look at the http-exception-mappings.properties file:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: org.jboss.soa.esb.services.security.SecurityServiceException=401<br />2: org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException=502<br /></code></pre>What this file indicates is that all requests that raise an exception of type org.jboss.soa.esb.services.security.SecurityServiceException will result in an HTTP return status code of 401 being returned to the client that sent in the request, and all requests that raise an exception of type org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException will result in an HTTP return sttaus code of 502 being returned. To illustrate how this, we'll invoke this service:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Exceptions" name="Exception1" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <http-gateway name="Exception2" /><br />4: </listeners><br />5: <actions mep="RequestResponse"><br />6: <!-- Uses the globally defined exception mappings defined on the <http-provider>... --><br />7: <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyExceptionAction"/><br />8: </actions><br />9: </service><br /></code></pre>The MyExceptionAction class is minimal - just enough code to throw an exception:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: public class MyExceptionAction extends AbstractActionPipelineProcessor {<br />2: <br />3: public MyExceptionAction(ConfigTree config) {<br />4: }<br />5: <br />6: public Message process(Message message) throws ActionProcessingException {<br />7: throw new MyActionException("MyActionException!!!!");<br />8: }<br />9: <br /></code></pre>To access this service, you point your browser at this URL: http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception1<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception1 -error_file=error.txt<br />2: org.jboss.soa.esb.couriers.FaultMessageException: org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException: MyActionException!!!!<br />3: at org.jboss.soa.esb.listeners.message.errors.Factory.createExceptionFromFault(Factory.java:50)<br />4: at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:207)<br />5: at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.attemptDelivery(ServiceInvoker.java:675)<br />6: at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.access$200(ServiceInvoker.java:569)<br />7: at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:359)<br />8: at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:219)<br />9: at org.jboss.soa.esb.listeners.gateway.http.HttpGatewayServlet.service(HttpGatewayServlet.java:187)<br />10: at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)<br />11: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<br />12: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />13: at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)<br />14: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<br />15: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />16: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)<br />17: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)<br />18: at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)<br />19: at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)<br />20: at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)<br />21: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<br />22: at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br />23: at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)<br />24: at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br />25: at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)<br />26: at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)<br />27: at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)<br />28: at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)<br />29: at java.lang.Thread.run(Thread.java:636)<br />30: Caused by: org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException: MyActionException!!!!<br />31: at org.jboss.soa.esb.samples.quickstart.httpgateway.MyExceptionAction.process(MyExceptionAction.java:34)<br />32: at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)<br />33: at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)<br />34: at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)<br />35: at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)<br />36: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)<br />37: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)<br />38: ... 1 more<br /></code></pre>And - here's the return code that we wanted:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: cat error.txt<br />2: URL=http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception1 (GET)<br />3: STATUS=HTTP/1.1 502 Bad Gateway<br /></code></pre><br /><b>Over-Riding a Global Exception</b><br /><br />It's good to be able to handle all exceptions at a global level. However, there may be times when you will want to receive a different return status code. To do this, you can over-ride that global setting. Here's a service definition to over-ride the global variable that we just discussed:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Exceptions" name="Exception2" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <http-gateway name="Exception1"><br />4: <!-- Override the exception mappings defined on the <http-provider>... --><br />5: <exception><br />6: <mapping class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException" status="503" /><br />7: </exception><br />8: </http-gateway><br />9: </listeners><br />10: <actions mep="RequestResponse"><br />11: <!-- Uses the override exception mappings defined on the <http-gateway>... --><br />12: <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyExceptionAction"/><br />13: </actions><br />14: </service><br /></code></pre>Line 6 is the one that we're interested in. Here's where we map the class that throws the exception to the code that is returned. And, here's what happens:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception2 -error_file=error.txt<br />2: org.jboss.soa.esb.couriers.FaultMessageException: org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException: MyActionException!!!!<br />3: at org.jboss.soa.esb.listeners.message.errors.Factory.createExceptionFromFault(Factory.java:50)<br />4: at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:207)<br />5: at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.attemptDelivery(ServiceInvoker.java:675)<br />6: at org.jboss.soa.esb.client.ServiceInvoker$EPRInvoker.access$200(ServiceInvoker.java:569)<br />7: at org.jboss.soa.esb.client.ServiceInvoker.post(ServiceInvoker.java:359)<br />8: at org.jboss.soa.esb.client.ServiceInvoker.deliverSync(ServiceInvoker.java:219)<br />9: at org.jboss.soa.esb.listeners.gateway.http.HttpGatewayServlet.service(HttpGatewayServlet.java:187)<br />10: at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)<br />11: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<br />12: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />13: at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)<br />14: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<br />15: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />16: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)<br />17: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)<br />18: at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)<br />19: at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)<br />20: at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)<br />21: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<br />22: at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br />23: at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)<br />24: at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br />25: at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)<br />26: at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)<br />27: at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)<br />28: at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)<br />29: at java.lang.Thread.run(Thread.java:636)<br />30: Caused by: org.jboss.soa.esb.samples.quickstart.httpgateway.MyActionException: MyActionException!!!!<br />31: at org.jboss.soa.esb.samples.quickstart.httpgateway.MyExceptionAction.process(MyExceptionAction.java:34)<br />32: at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)<br />33: at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)<br />34: at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)<br />35: at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)<br />36: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)<br />37: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)<br />38: ... 1 more<br />39: <br />40: cat error.txt<br />41: URL=http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception2 (GET)<br />42: STATUS=HTTP/1.1 503 Service Unavailable<br /></code></pre><br /><b>An Asynchronous Response</b><br /><br />So far, we've only seen synchronous responses to our requests. It's also possible to have the invoked service respond asynchronously. Here's the quickstart's service definition that illustrates this:<br /><br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Async" name="List" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/Async/List<br />4: Uses the default http bus configuration... --><br />5: <http-gateway name="Async"><br />6: <asyncResponse statusCode="202"><br />7: <payload classpathResource="/readme.txt" contentType="text/plain" characterEncoding="UTF-8" /><br />8: </asyncResponse><br />9: </http-gateway><br />10: </listeners><br />11: <actions mep="RequestResponse"><br />12: <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/><br />13: </actions><br />14: </service> </code><br /></pre><ul><li>Line 5: This is where the asynchronous response definition starts. Note that the return code is 202.<br /></li><li>Line 6: And. we're also able to specify a file, the contents of which will be returned as a static payload in the response along with the return code.<br /></li></ul><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source http://localhost:8080/Quickstart_http_gateway/http/Async/List -error_file=error.txt<br />2: Overview:<br />3: =========<br />4: The purpose of the http_gateway quickstart sample is to demonstarte how to<br />5: configue a http gateway to pass the http request into ESB service.<br />6: <br />7: <br />8: Running this quickstart:<br />9: ========================<br />10: Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts<br />11: and a more detailed descripton of the different ways to run the quickstarts.<br />12: <br />13: To Run '.esb' archive mode:<br />14: ===========================<br />15: 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.<br />16: 2. Open the web brower and send http requests to the following addresses. Be sure to<br />17: check the Server console after executing each request:<br />18: a) http://localhost:8080/Quickstart_http_gateway/http/sales/a/b/c - Will be routed to the Sales:List<br />19: service. Will return some details about the request. This Service's <http-gateway> references a<br />20: "secureFriends" bus, which contains login configurations. The login username is "kermit" and the<br />21: password is "thefrog". It usee the "java:/jaas/JBossWS" security domain, which is already installed<br />22: in your JBoss ESB/App Server.<br />23: b) http://localhost:8080/Quickstart_http_gateway/http/index/XXXX/yyy?a=1,b=2 - Will be routed to the Index:List<br />24: service. Will return some details about the request. This Service's <http-listener> does not refer<br />25: to any bus and so simply uses the "default" http bus.<br />26: c) http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception1 - Will be routed to the<br />27: Exceptions:Exception1 service. This service throws a "MyActionException", resulting in a<br />28: 502 (Bad Gateway) status being returned in accordance with the Exception to HTTP status code<br />29: mappings defined globally on the <http-provider>.<br />30: d) http://localhost:8080/Quickstart_http_gateway/http/Exceptions/Exception2 - Will be routed to the<br />31: Exceptions:Exception2 service. This service also throws a "MyActionException", but the <http-gateway><br />32: on this service overrides the globally defined Exception to HTTP status code mappings defined globally<br />33: on the <http-provider> to return a 503 (Service Unavailable) status for the "MyActionException" exception.<br />34: e) http://localhost:8080/Quickstart_http_gateway/http/Async/List - Will be routed to the<br />35: Async:List service, which responds asynchronously with a 202 (Accepted) response code and a static<br />36: payload of this readme.txt.<br />37: f) http://localhost:8080/Quickstart_http_gateway/http/soap/ - Will be routed to the<br />38: Soap:List service, which requires message level seurity. An 401 error will occur. Now<br />39: switch to the command line and run "ant soap". This POSTs a SOAP message, with login credentials<br />40: to the gateway. The service should respond successfully this time!!<br />41: 3. In this folder ("Window1"), type 'ant undeploy'.<br />42: <br />43: cat error.txt<br />44: URL=http://localhost:8080/Quickstart_http_gateway/http/Async/List (GET)<br />45: STATUS=HTTP/1.1 202 Accepted<br /></code></pre><br /><b>SOAP and Security</b><br /><br />The quickstart finishes where it began; with an example of some basic security. Here's the service definition:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <service category="Soap" name="List" description="" invmScope="GLOBAL"><br />2: <listeners><br />3: <!-- Receives: http://<host>:<port>/Quickstart_http_gateway/http/soap/*<br />4: Execute "ant soap" on command line.... --><br />5: <http-gateway name="soap" busidref="secureFriends" urlPattern="soap/*"><br />6: <exception><br />7: <mapping class="org.jboss.soa.esb.services.security.SecurityServiceException" status="401" /><br />8: </exception><br />9: </http-gateway><br />10: </listeners><br />11: <actions mep="RequestResponse"><br />12: <action name="print" class="org.jboss.soa.esb.samples.quickstart.httpgateway.MyAction"/><br />13: </actions><br />14: </service> </code><br /></pre><ul><li>Line 5: Here's the http-gateway definition. Note that we're using the "secureFriends" busidref again. (This means that kermit will have to login again.)<br /></li><li>Line 7: And, here's the exception that we'll throw, with a return status code of 401.<br /></li></ul>Sure enough, when we send a request, we get that exception and return code:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: lynx -dump -source http://localhost:8080/Quickstart_http_gateway/http/soap -error_file=error.txt<br />2: HTTP: Access authorization required.<br />3: Use the -auth=id:pw parameter.<br />4: <br />5: Looking up localhost:8080<br />6: Making HTTP connection to localhost:8080<br />7: Sending HTTP request.<br />8: HTTP request sent; waiting for response.<br />9: Alert!: Access without authorization denied -- retrying<br />10: <br />11: lynx: Can't access startfile http://localhost:8080/Quickstart_http_gateway/http/soap<br />12: <br />13: cat error.txt<br />14: URL=http://localhost:8080/Quickstart_http_gateway/http/soap (GET)<br />15: STATUS=HTTP/1.1 401 Unauthorized<br /></code></pre>Now, we could just provide login credentials manually through the browser UI, but we want our client code to be able to do this programatically. The answer to avoiding this exception, is ot have request that we send has to include login credentials. The quickstart's build.xml file provides an ant target to do this for you by invoking the JBossESB HttpRouter action (org.jboss.soa.esb.actions.routing.http.HttpRouter). This action is one of the JBossESB's large set of "out-of-the-box" actions.<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <target name="soap" depends="compile" description="sends a SOAP HTTP request to the http gateway"><br />2: <echo>Http Client</echo><br />3: <java fork="yes" classname="org.jboss.soa.esb.actions.routing.http.HttpRouter" failonerror="true"><br />4: <arg value="endpointUrl=http://localhost:8080/Quickstart_http_gateway/http/soap/"/><br />5: <!-- The EBWS is secured with container level security --><br />6: <arg value="configurators=HttpProtocol,AuthBASIC"/><br />7: <arg value="method=POST"/><br />8: <arg value="auth-username=kermit"/><br />9: <arg value="auth-password=thefrog"/><br />10: <arg value="authscope-host=localhost"/><br />11: <arg value="authscope-port=8080"/><br />12: <!-- The actual payload to POST --><br />13: <arg value="payload=soap-login.xml"/><br />14: <classpath refid="exec-classpath"/><br />15: </java><br />16: </target><br /></code></pre>The actual message payload that is sent is defined in the soap-login.xml file is:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"<br />2: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />3: xmlns:xsd="http://www.w3.org/2001/XMLSchema"><br />4: <br />5: <soap:Header><br />6: </soap:Header><br />7: <br />8: <soap:Body><br />9: </soap:Body><br />10: <br />11: </soap:Envelope><br /></code></pre>And, the successful results look like this:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: soap:<br />2: [echo] Http Client<br />3: [java] Request payload:<br />4: [java] <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"<br />5: [java] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />6: [java] xmlns:xsd="http://www.w3.org/2001/XMLSchema"><br />7: [java]<br />8: [java] <soap:Header><br />9: [java] </soap:Header><br />10: [java]<br />11: [java] <soap:Body><br />12: [java] </soap:Body><br />13: [java]<br />14: [java] </soap:Envelope><br />15: [java]<br />16: [java] --------------------------<br />17: [java]<br />18: [java]<br />19: [java] Response Status Code: 200<br />20: [java] Response payload:<br />21: [java] Service: Soap:List<br />22: [java]<br />23: [java] ------------Http Request Info (XStream Encoded)-------------------<br />24: [java] <org.jboss.soa.esb.http.HttpRequest><br />25: [java] <authType>BASIC</authType><br />26: [java] <characterEncoding>UTF-8</characterEncoding><br />27: [java] <contentType>text/xml;charset=UTF-8</contentType><br />28: [java] <contextPath>/Quickstart_http_gateway</contextPath><br />29: [java] <localAddr>127.0.0.1</localAddr><br />30: [java] <localName>localhost.localdomain</localName><br />31: [java] <method>POST</method><br />32: [java] <pathInfo>/</pathInfo><br />33: [java] <protocol>HTTP/1.1</protocol><br />34: [java] <remoteAddr>127.0.0.1</remoteAddr><br />35: [java] <remoteHost>127.0.0.1</remoteHost><br />36: [java] <remoteUser>kermit</remoteUser><br />37: [java] <contentLength>268</contentLength><br />38: [java] <requestURI>/Quickstart_http_gateway/http/soap/</requestURI><br />39: [java] <scheme>http</scheme><br />40: [java] <serverName>localhost</serverName><br />41: [java] <requestPath>/http/soap</requestPath><br />42: [java] <pathInfoTokens/><br />43: [java] <queryParams/><br />44: [java] <headers><br />45: [java] <org.jboss.soa.esb.http.HttpHeader><br />46: [java] <name>content-type</name><br />47: [java] <value>text/xml;charset=UTF-8</value><br />48: [java] </org.jboss.soa.esb.http.HttpHeader><br />49: [java] <org.jboss.soa.esb.http.HttpHeader><br />50: [java] <name>user-agent</name><br />51: [java] <value>Jakarta Commons-HttpClient/3.0.1</value><br />52: [java] </org.jboss.soa.esb.http.HttpHeader><br />53: [java] <org.jboss.soa.esb.http.HttpHeader><br />54: [java] <name>content-length</name><br />55: [java] <value>268</value><br />56: [java] </org.jboss.soa.esb.http.HttpHeader><br />57: [java] <org.jboss.soa.esb.http.HttpHeader><br />58: [java] <name>authorization</name><br />59: [java] <value>Basic a2VybWl0OnRoZWZyb2c=</value><br />60: [java] </org.jboss.soa.esb.http.HttpHeader><br />61: [java] <org.jboss.soa.esb.http.HttpHeader><br />62: [java] <name>host</name><br />63: [java] <value>localhost:8080</value><br />64: [java] </org.jboss.soa.esb.http.HttpHeader><br />65: [java] </headers><br />66: [java] </org.jboss.soa.esb.http.HttpRequest><br />67: [java] --------------------------<br />68: [java]<br /></code></pre><br /><b>Closing Thoughts</b><br /><br />The JBossESB's new http-gateway provides great flexibility in integrating HTTP applications across the ESB. The http_gateway quickstart illustrates some of this flexibility, and, incidentally, shows just how much you can do without writing a lot of custom code. Did you notice while eading this post, that we didn't have to write support routines to handle authentication, exception handling, and dealing with URL patterns? The http-gateway and the JBossESB did the heavy lifting for us.<br /><br /><b>Acknowledgements</b><br /><br />Thanks to the JBossESB community and its contributors (see <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/Contributors.txt">http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/Contributors.txt</a>) - and to Kevin Conner for his timely review comments!<br /><br /><b>References</b><br /><br /><a name="[1]">[1]</a> http://www.jboss.org/community/wiki/HTTPGateway<br /><a name="[2]">[2]</a> http://jboss-soa-p.blogspot.com/2009/09/works-great-right-out-of-box.html<br /><a name="[3]">[3]</a> http://www.jboss.org/jbossesb/docs/4.7/manuals/html/ProgrammersGuide.html<br /><a name="[4]">[4]</a> http://en.wikipedia.org/wiki/Digest_access_authentication<br /><br /><br /></http-listener>Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com3tag:blogger.com,1999:blog-8048607794005651608.post-10224332507241825392009-11-30T05:23:00.000-08:002009-11-30T06:49:59.399-08:00Proxying SOAP Web Services in JBossESB 4.7JBossESB supports SOAP web services via various mechanisms:<br /><ul><li>SOAPClient for invoking external web services.</li><li>SOAPProducer for invoking internally-deployed JBossWS services.</li><li>EBWS (ESB-Based Web Services) for decorating service requests/responses with a SOAP Envelope.</li><li>HttpRouter can be used to manually invoke an HTTP endpoint.</li><li>Explicit support for web service proxying via the <a href="http://www.jboss.org/jbossesb/docs/4.7/javadoc/esb/org/jboss/soa/esb/actions/soap/proxy/SOAPProxy.html">SOAPProxy</a> action.<br /></li></ul><span style="font-weight: bold; font-style: italic;">Why would I want to proxy a web service from the ESB?</span><br /><ul><li>To provide loose coupling between the client and the proxied service: the client no longer needs to have a direct connection to the remote host.</li><li>The WSDL contract can be transformed to modify it's parameters or change the service's declared capabilities.</li><li>A transformation of the SOAP envelope/body can be introduced via the ESB action chain both for the inbound request and outbound response (via <a href="http://www.jboss.org/jbossesb/docs/4.7/javadoc/esb/org/jboss/soa/esb/actions/transformation/xslt/XsltAction.html">XsltAction</a> or <a href="http://www.jboss.org/jbossesb/docs/4.7/javadoc/esb/org/jboss/soa/esb/smooks/SmooksAction.html">SmooksAction</a>). Other custom processing can also be introduced in the chain.</li><li>Service versioning is possible since clients can connect to 2 or more proxy endpoints on the ESB, each with its own WSDL and/or transformations and routing requirements, and the ESB will send the appropriate message to the appropriate endpoint and provide an ultimate response.</li><li>Complex context-based routing via ContentBasedRouter.</li></ul>Here is a figure of a basic web service proxy in the ESB:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3Inn8MOHmqk/SxPIAzqx3aI/AAAAAAAAAHE/GMW8tpwK3yk/s1600/proxy.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 173px;" src="http://2.bp.blogspot.com/_3Inn8MOHmqk/SxPIAzqx3aI/AAAAAAAAAHE/GMW8tpwK3yk/s400/proxy.png" alt="" id="BLOGGER_PHOTO_ID_5409887493597289890" border="0" /></a><br />As you can see, the ESB action chain can perform any number of out-of-the-box or custom actions before or after the call to the proxied web service. Also, the client of the ESB as well as the proxied web service do not have to be Java-based.<br /><br /><span style="font-weight: bold; font-style: italic;">Show me how to configure the ESB to proxy to a .NET-based SOAP web service.<br /><br /></span>Here it is in 15 short lines:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">1: <?xml version="1.0" encoding="UTF-8"?><br />2: <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5"><br />3: <services><br />4: <service category="Stock" name="Quote" description="Stock Quote" invmScope="GLOBAL"><br />5: <listeners><br />6: <http-gateway name="StockQuote-GwListener"/><br />7: </listeners><br />8: <actions mep="RequestResponse"><br />9: <action name="proxy" class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy"><br />10: <property name="wsdl" value="http://www.webservicex.net/stockquote.asmx?WSDL"/><br />11: </action><br />12: </actions><br />13: </service><br />14: </services><br />15: </jbossesb><br /></code></pre><br />Line 8 specifies a request/response message exchange pattern. Line 9 adds the SOAPProxy action to the processing pipeline. Line 10 is the only <span style="font-style: italic;">required</span> property: the wsdl location. In this example, we are proxying to a .NET-based stock quote service. Line 6 specifies the use of the newly supported <a href="http://www.jboss.org/community/wiki/HTTPGateway">HTTPGateway</a>, introduced in <a href="http://www.jboss.org/jbossesb/downloads/">JBossESB 4.7</a>.<br /><br />When a .esb archive is deployed with this configuration, you will see output like this in the server console:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">07:17:51,789 INFO [SOAPProxy] mapped soapaction ["http://www.webserviceX.NET/GetQuote"] to binding [{http://www.webserviceX.NET/}StockQuoteSoap]<br />07:17:51,790 INFO [SOAPProxy] mapped binding [{http://www.webserviceX.NET/}StockQuoteSoap] to transport [org.jboss.soa.esb.actions.soap.proxy.HttpSOAPProxyTransport] with endpoint address: [http://www.webservicex.net/stockquote.asmx]<br /></code></pre><br />At this point, the SOAPProxy has transformed the wsdl by rewriting it's soap:address location to the ESB server, so clients of the ESB will invoke it rather than the proxied service itself (line 3 below):<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">1: <wsdl:service name="StockQuote"><br />2: <wsdl:port binding="tns:StockQuoteSoap" name="StockQuoteSoap"><br />3: <soap:address location="http://192.168.1.103:8080/sample/http/Stock/Quote"/><br />4: </wsdl:port><br />5: </wsdl:service><br /></code></pre><br />With the introduction of the new <a href="http://www.jboss.org/community/wiki/HTTPGateway">HTTPGateway</a>, the wsdl is available at the well-known location of the endpoint URL + "?wsdl" (or "?WSDL"), as shown in the following screenshot of the ESB contract application, available at http://host:port/contract/<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3Inn8MOHmqk/SxPNKlCCsyI/AAAAAAAAAHM/lIRCGmJOxFY/s1600/JBoss_ESB_Service_Deployments.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 114px;" src="http://2.bp.blogspot.com/_3Inn8MOHmqk/SxPNKlCCsyI/AAAAAAAAAHM/lIRCGmJOxFY/s400/JBoss_ESB_Service_Deployments.png" alt="" id="BLOGGER_PHOTO_ID_5409893159025160994" border="0" /></a>In our case, the wsdl URL is http://192.168.1.103:8080/sample/http/Stock/Quote?wsdl<br />To invoke the ESB, we can use a tool like <a href="http://www.soapui.org/">soapUI</a> to send a test request to http://192.168.1.103:8080/sample/http/Stock/Quote<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">1: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/"><br />2: <soapenv:Header/><br />3: <soapenv:Body><br />4: <web:GetQuote><br />5: <web:symbol>RHT</web:symbol><br />6: </web:GetQuote><br />7: </soapenv:Body><br />8: </soapenv:Envelope><br /></code></pre><br />The <a href="http://www.jboss.org/community/wiki/HTTPGateway">HTTPGateway</a> will receive the request, the SOAPProxy action will invoke the proxied .NET stock quote service, and the following response will be returned:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">1: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><br />2: <soap:Body><br />3: <GetQuoteResponse xmlns="http://www.webserviceX.NET/"><br />4: <GetQuoteResult><![CDATA[<StockQuotes><Stock><Symbol>RHT</Symbol><Last>26.80</Last><Date>11/27/2009</Date><Time>1:00pm</Time><Change>0.00</Change><Open>N/A</Open><High>N/A</High><Low>N/A</Low><Volume>0</Volume><MktCap>5.032B</MktCap><PreviousClose>26.80</PreviousClose><PercentageChange>0.00%</PercentageChange><AnnRange>8.30 - 28.94</AnnRange><Earns>0.448</Earns><P-E>59.82</P-E><Name>RED HAT INC</Name></Stock></StockQuotes>]]></GetQuoteResult><br />5: </GetQuoteResponse><br />6: </soap:Body><br />7: </soap:Envelope><br /></code></pre><br /><span style="font-style: italic; font-weight: bold;">Why can't I just use HttpRouter to do this?</span><br /><ol><li>HttpRouter can only talk to one endpoint. One WSDL can specify multiple soap:address locations. With the SOAPProxy, you just config the one location of the WSDL, and it can dynamically route the request to the correct soap:address location.</li><li>To use HttpRouter with SOAP, you have to always configure a MappedHeaderList (usually "Content-Type, Accept, Authorization, SOAPAction"). This is unnecessary with the SOAPProxy.</li><li>The SOAPProxy allows you to specify a wsdlTransform, which allows you to transform the original WSDL to something else you want the SOAPProxy to expose. (This handles the "versioning" use case, and also usually means you'll want to use XsltAction or SmooksAction in the action pipeline.)</li><li>If you are proxying to a BASIC Auth secured web service, the "clientCredentialsRequired" property of the SOAPProxy allows you to specify if the credentials should be passed into the SOAPProxy from the client (the default, in which case the credentials are propagated), or if you want the proxy to be wide-open, but <span style="font-style: italic;">it</span> will handle the authentication to the proxied service for you.</li><li>SOAPProxy is designed to talk to more than just HTTP endpoints, although HTTP is all that is implemented right now.</li><li>When using the new <a href="http://www.jboss.org/community/wiki/HTTPGateway">HTTPGateway</a> to front the SOAPProxy, the ESB will automatically transform and cache the WSDL and make it available at the well-known location of ${endpoint}?wsdl (or ?WSDL). </li></ol><span style="font-style: italic; font-weight: bold;">Tell me more about security</span><span style="font-weight: bold;">.</span><br /><br />As mentioned in #4 above, the SOAPProxy can invoke external web services that are protected by BASIC Auth. In addition, these services can also be encrypted using SSL. Here is an example configuration taken from the <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_7/product/samples/quickstarts/webservice_proxy_security/">webservice_proxy_security</a> quickstart which comes bundled with <a href="http://www.jboss.org/jbossesb/downloads/">JBossESB 4.7</a>:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">1: <?xml version="1.0" encoding="UTF-8"?><br />2: <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5"><br />3: <globals><br />4: <war-security method="BASIC" domain="JBossWS"/><br />5: </globals><br />6: <providers><br />7: <http-provider name="HTTP-PROVIDER"><br />8: <http-bus busid="HTTP-BUS" transportGuarantee="CONFIDENTIAL"><br />9: <allowed-roles><br />10: <role name="friend"/><br />11: </allowed-roles><br />12: </http-bus><br />13: </http-provider><br />14: </providers><br />15: <services><br />16: <service category="Proxy_Security" name="Proxy" description="Security WebService Proxy" invmScope="GLOBAL"><br />17: <listeners><br />18: <http-gateway name="HTTP-GATEWAY" busidref="HTTP-BUS" urlPattern="ProxyWS/*"/><br />19: </listeners><br />20: <actions mep="RequestResponse"><br />21: <action name="proxy" class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy"><br />22: <!-- property name="wsdl" value="https://localhost:8443/webservice_proxy_security/HelloWorldWS?wsdl"/ --><br />23: <property name="wsdl" value="internal://jboss.ws:context=webservice_proxy_security,endpoint=HelloWorldWS"/><br />24: <property name="endpointUrl" value="https://localhost:8443/webservice_proxy_security/HelloWorldWS"/><br />25: <property name="file" value="/META-INF/httpclient-8443.properties"/><br />26: </action><br />27: </actions><br />28: </service><br />29: </services><br />30: </jbossesb><br /></code></pre>Lines 3-14 configure the <a href="http://www.jboss.org/community/wiki/HTTPGateway">HTTPGateway</a> for BASIC Auth and SSL support. Line 24 overrides the endpointUrl. This is an example of an HttpRouter property (Note: the SOAPProxy wraps usage of HttpRouter), a useful property when domain name matching is important for SSL certs. Line 25 specifies a <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_7/product/samples/quickstarts/webservice_proxy_security/httpclient-8443.properties">properties file</a> for httpclient configuration.<br /><br /><span style="font-style: italic;"><span style="font-weight: bold;">What's with the "internal" wsdl location?</span><span style="font-style: italic;"></span></span><br /><br />Line 22 (a "normal" http URL) is commented out and instead, on Line 23, you see an "internal" URL. In <a href="http://www.jboss.org/jbossesb/downloads/">JBossESB 4.7</a>, the value can reference a location based on five different schemes: http, https, file, classpath or internal (JBossWS jmx mbean object name). Here are some examples:<br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) none repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0); word-wrap: normal;">http://localhost:8080/Quickstart_webservice_proxy_basic_ws/HelloWorldWS?wsdl<br />https://localhost:8443/webservice_proxy_security/HelloWorldWS?wsdl<br />file:///tmp/HelloWorldWS.wsdl<br />classpath://META-INF/HelloWorldWS.wsdl<br />internal://jboss.ws:context=Quickstart_webservice_proxy_basic_ws,endpoint=HelloWorldWS<br /></code></pre><span style="font-weight: bold; font-style: italic;"><br />I want to learn more...<br /><br /></span>Other quickstart samples available are <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_7/product/samples/quickstarts/webservice_proxy_basic/">webservice_proxy_basic</a>, <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_7/product/samples/quickstarts/webservice_proxy_routed/">webservice_proxy_routed</a> (an example using the ContentBasedRouter to route to one of two proxied endpoints) and <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_7/product/samples/quickstarts/webservice_proxy_versioning/">webservice_proxy_versioning</a> (an example showing support for old and new versions of the same endpoint via transformation).<br /><br />Of course, you are always welcome to ask questions in the <a href="http://www.jboss.org/index.html?module=bb&op=viewforum&f=246">JBossESB project forum</a>.Anonymousnoreply@blogger.com20tag:blogger.com,1999:blog-8048607794005651608.post-91864639361987973542009-11-23T17:58:00.000-08:002009-11-30T07:51:00.630-08:00MessageAlerts in JBossESB 4.7<b>Is One of My Services or Actions Clogging Things Up?</b><br /><br />JBossESB 4.7 includes some great new features. In this post, I wanted to highlight a feature that can help answer the above question.<br /><br />The new feature feature is "MessageAlerts" (org.jboss.soa.esb.listeners.message.MessageAlerts). This feature enables you to collect fine grained information on the processing time or number of bytes that a specific service, or a specific action in a service requires to process a single message.<br /><br />You use MessageAlerts by defining processing time and byte total thresholds on a per service and/or action basis. When the service or action in question takes longer than the defined time threshold to process a message, a WARNING is written to the server log and made available in the JMX console. You define the thresholds with these properties:<br /><br />alertTimeThreshold="420"<br />alertLengthThreshold="10"<br /><br />The time-related threshold is measured in milliseconds. The length-related threshold is measured in bytes.<br /><br />When would you use the byte total threshold? This can be useful if, for example, the service or action that you are watching performs transformations, and suddenly begins processing way more bytes than you're expecting that it should.<br /><br /><b>An Example in a Quickstart</b><br /><br />The MessageAlerts feature is demonstrated in a quickstart named, appropriately enough, "messagealert." If you've ever run the "helloworld" quickstart, then this quickstart should be familiar. The only changes are the addition of the org.jboss.soa.esb.samples.quickstart.messagealerts.DelayAction action class (as you can guess by the name, this class introduces a delay to cause the alertTimeThreshold to be reached, and the changes in the jboss-esb.xml file listed below:<br /><br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);">1: <services><br />2: <service<br />3: category="FirstServiceESB"<br />4: name="SimpleListener"<br />5: description="Hello World"<br />6: alertTimeThreshold="420"<br />7: alertLengthThreshold="10"<br />8: ><br />9: <listeners><br />10: <jms-listener name="JMS-Gateway"<br />11: busidref="quickstartGwChannel"<br />12: is-gateway="true"<br />13: /><br />14: <jms-listener name="helloWorld"<br />15: busidref="quickstartEsbChannel"<br />16: /><br />17: </listeners><br />18: <actions mep="OneWay"><br />19: <action name="action1"<br />20: class="org.jboss.soa.esb.samples.quickstart.messagealerts.MyJMSListenerAction"<br />21: process="displayMessage"<br />22: /><br />23: <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln"><br />24: <property name="printfull" value="false"/><br />25: </action><br />26: <action name="action3"<br />27: class="org.jboss.soa.esb.samples.quickstart.messagealerts.DelayAction"<br />28: process="delayMessage"<br />29: alertTimeThreshold="30"<br />30: alertLengthThreshold="50"><br />31: </action><br />32: </actions><br />33: </service><br />34: </services><br /></code></pre><br /><br />The changes related to MessageAlerts are:<br /><ul><li>Lines 6-7: These set the service thresholds at 420 milliseconds in time and 10 bytes in length.<br /></li><li>Lines 29-30: And, these set the action thresholds at 30 milliseconds in time and 50 bytes in length.<br /></li></ul>When we deploy and run the quickstart, the following is written to the server.log:<br /><br /><pre style="border: 1px dashed rgb(204, 204, 204); padding: 0px; background: rgb(240, 240, 240) url(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif) repeat scroll 0% 0%; overflow: auto; font-family: arial; font-size: 12px; width: 99%; height: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: rgb(0, 0, 0); text-align: left; line-height: 20px;"><code style="color: rgb(0, 0, 0);"> 22:00:28,833 INFO [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&<br />22:00:28,837 INFO [STDOUT] Body: Message Alerts<br />22:00:28,837 INFO [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&<br />22:00:28,850 INFO [STDOUT] Message structure:<br />22:00:28,850 INFO [STDOUT] [Message Alerts].<br />22:00:31,852 WARN [ServiceMessageCounter] jboss.esb:category=MessageCounter,deployment=Quickstart_messagealerts.esb,service-category=FirstServiceESB,service-name=SimpleListener service, action3 action alert time 3001 took longer than 30 ms<br />22:00:31,853 WARN [ServiceMessageCounter] jboss.esb:category=MessageCounter,deployment=Quickstart_messagealerts.esb,service-category=FirstServiceESB,service-name=SimpleListener service, action3 action message size 2960 was larger than 50 bytes<br />22:00:31,853 WARN [ServiceMessageCounter] jboss.esb:category=MessageCounter,deployment=Quickstart_messagealerts.esb,service-category=FirstServiceESB,service-name=SimpleListener service alert time 3007 took longer than 420 ms<br />22:00:31,854 WARN [ServiceMessageCounter] jboss.esb:category=MessageCounter,deployment=Quickstart_messagealerts.esb,service-category=FirstServiceESB,service-name=SimpleListener service message size 2960 was larger than 10 bytes<br /></code></pre><br /><br />And, the same information is available in the JMX log under jboss.esb, service=MessageAlerts:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Wad47xG7w3A/Sws-uz5dxvI/AAAAAAAAA_c/wdclgpnnGuM/s1600/Screenshot-1.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://2.bp.blogspot.com/_Wad47xG7w3A/Sws-uz5dxvI/AAAAAAAAA_c/wdclgpnnGuM/s400/Screenshot-1.png" alt="" id="BLOGGER_PHOTO_ID_5407484751514552050" border="0" /></a><br />As you can see in this screenshot, you can reset the counters through the JMX console. (And, yes, as you can also see in this screenshot, I'm staying up way too late at night writing about this stuff.)<br /><br />You can also access the same information from the jboss.esb mbean directly:<br /><pre>sh ./twiddle.sh get "jboss.esb:service=MessageAlerts"</pre><br />And, for extra credit, you can access the MessageAlerts service programatically. To do this, first, we'll modify the quickstart's jboss-esb.xml file to move the action that prints information to the server log to happen after the delay (and therefore after the MessageAlerts have been generated).<br /><br />Then, we'll replace the code in MyJMSListenerAction.java with this:<br /><br /><pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;">1: package org.jboss.soa.esb.samples.quickstart.messagealerts; <br />2: <br />3: import org.jboss.soa.esb.actions.AbstractActionLifecycle; <br />4: import org.jboss.soa.esb.helpers.ConfigTree; <br />5: import org.jboss.soa.esb.message.Message; <br />6: <br />7: import javax.management.ObjectName; <br />8: import javax.management.MBeanServer; <br />9: import javax.management.MalformedObjectNameException; <br />10: <br />11: import org.jboss.mx.util.MBeanProxyExt; <br />12: import org.jboss.mx.util.MBeanServerLocator; <br />13: import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor; <br />14: import org.jboss.soa.esb.actions.ActionProcessingException; <br />15: <br />16: import java.util.Vector; <br />17: <br />18: public class MyJMSListenerAction extends AbstractActionLifecycle <br />19: { <br />20: <br />21: protected ConfigTree _config; <br />22: <br />23: public MyJMSListenerAction(ConfigTree config) { _config = config; } <br />24: <br />25: public Message displayMessage(Message message) throws Exception{ <br />26: <br />27: MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss(); <br />28: Vector theAlertsVector = (Vector)server.getAttribute(new ObjectName("jboss.esb:service=MessageAlerts"), "Alerts"); <br />29: <br />30: for (int i = 0; i < theAlertsVector.size(); i++ ) { <br />31: System.out.println("******Data returned from MessageAlert[" + i + "] = " + theAlertsVector.elementAt(i) + "\n" ); <br />32: } <br />33: <br />34: System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); <br />35: System.out.println("Body: " + message.getBody().get()) ; <br />36: System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); <br />37: return message; <br />38: } <br />39: <br />40: } <br /></code></pre><br /><br /><ul><li>Line 27: Locates the MBeanServer - this is easy as we are running in the same JVM as the server<br /></li><li>Line 28: Retrieves the Vector of MessageAlerts from the jboss.esb MessageAlerts service<br /></li><li>Lines 30-33: and prints them out<br /></li></ul><b>Closing Thoughts</b><br /><br />The ability to building your own services and custom actions with JBossESB is one characteristic of its overall flexibility. With MessageAlerts, you can more easily track the efficiency of those services and actions, at a fine grained level. The message alert feature makes it simple.<br /><br /><b>Acknowledgements</b><br /><br />Thanks to Tom Cunningham for his input to this post and his patient responses to my many questions!Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-63579225067558773432009-10-02T06:05:00.000-07:002009-10-02T06:07:45.002-07:00Content Based Routing in JBossESB Just Got EasierOne of the main tasks that the JBossESB performs is that of routing messages to the correct services. (As I never tire of telling people, in the context of the ESB, everything is either a message or a service. ;-) The ESB supports multiple types of message routing, including routing based on the content of the message itself. This Content Based Routing (CBR) was originally implemented in the ESB by means of using JBoss Drools.<a href="#[1]">[1]</a><br /><br />JBoss Drools is a complete enterprise platform for rules-based application development, workflow, administration, and event processing. It also provides an integration with JBossESB to support content based routing. You define the content based routing algorithm in a set of rules.<br /><br />But, Drools might be a larger tool than you may want to use for some routing tasks.<br /><br />Two additional (and simpler) approaches for content based routing were just added to the JBossESB project. (Note that these were added to the JBoss ESB project in trunk here: <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk">http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk</a> and should be in the next project release.) Let's take a look at these new approaches for content based routing as illustrated in the "jbos-esb.xml" file of the "fun_cbr" quickstart sample application:<br /><br /><b>XPath Content Based Routing</b><br /><br />To configure XPath content based routing you define a service like this:<br /><pre>32 <service category="Fun_CBRServices_ESB" name="XPath_FunCBRService_ESB" description="ESB Listener - for the native clients" invmScope="GLOBAL"><br />33 <listeners><br />34 <!-- Gateway --><br />35 <jms-listener name="TheGateway" busidref="xpathQuickstartGwChannel" is-gateway="true" /><br />36 </listeners><br />37 <actions mep="OneWay"><br />38 <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter"><br />39 <property name="cbrAlias" value="XPath"/><br />40 <property name="destinations"><br />41 <namespace prefix="ord" uri="http://org.jboss.soa.esb/Order" /><br />42 <route-to service-category="BlueTeam" service-name="GoBlue" expression="/ord:Order[@statusCode='0']" /><br />43 <route-to service-category="RedTeam" service-name="GoRed" expression="/ord:Order[@statusCode='1']" /><br />44 <route-to service-category="GreenTeam" service-name="GoGreen" expression="/ord:Order[@statusCode='2']" /><br />45 </property><br />46 </action><br />47 </actions><br />48 </service><br /></pre>The "cbrAlias" property defined on line 39 indicates that one of the new approaches for content based routing is to be used. On line 41 the namespace is defined and lines 42-44 define the actual routes. Note that this is completely defined in the jboss-esb.xml file. No additional configuration files are needed.<br /><br /><b>Regex Content Based Routing</b><br /><pre>52 <service category="Fun_CBRServices_ESB" name="Regex_FunCBRService_ESB" description="ESB Listener - for the native clients" invmScope="GLOBAL"><br />53 <listeners><br />54 <!-- Gateway --><br />55 <jms-listener name="TheGateway" busidref="regexQuickstartGwChannel" is-gateway="true" /><br />56 </listeners><br />57 <actions mep="OneWay"><br />58 <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter"><br />59 <property name="cbrAlias" value="Regex"/><br />60 <property name="ruleSet" value="/regex-rules.properties"/> <br />61 <property name="ruleReload" value="true"/><br />62 <property name="destinations"><br />63 <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" /><br />64 <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" /><br />65 <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" /><br />66 </property><br />67 </action><br />68 </actions><br />69 </service><br /></pre>Again, Line 59 defines the cbrAlias property and lines 63-65 define the actual paths. On line 60, we have a reference to the external file that contains the XPath expressions that will govern the routing. That file looks like this:<br /><pre>1 blue=.* statusCode="0".*<br />2 red=.* statusCode="1".*<br />3 green=.* statusCode="2".*<br /></pre><span style="font-style: italic;">It's important to note that any applications built with Drools-based content based routing will continue to function without needing any changes or migrations.</span><br /><br />To sum it up, content based routing has always been a flexible way to route messages to services. With these changes to JBossESB, it's even easier to use.<br /><br /><b>References</b><br /><a name="[1]"></a>[1] <a href="http://jboss-soa-p.blogspot.com/2009/07/when-content-knows-way-content-based.html">http://jboss-soa-p.blogspot.com/2009/07/when-content-knows-way-content-based.html</a>Len DiMaggiohttp://www.blogger.com/profile/07124585546929851174noreply@blogger.com6tag:blogger.com,1999:blog-8048607794005651608.post-40864786599509344962009-09-30T06:46:00.000-07:002009-09-30T06:51:07.993-07:00JBoss Tools Editor for Smooks… Let us hear what you think…<div class="postcontent"><p>Of late, we've been making more of a push on the Eclipse Tooling for Smooks within JBoss Tools. Prior to a few weeks ago, Dart Peng was “more or less” left to his own devices on this work, without much help from myself or anyone else. More recently, Brian Fitzpatrick and I have been more actively contributing to the great work being done by Dart.</p> <p>Brian has been blogging about this work <a href="http://jbosstools.blogspot.com/2009/09/seeking-feedback-on-smooks.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/jbosstools.blogspot.com');">here on the JBoss Tools blog.</a> Please take a look and contribute your throughs and ideas!!!</p><p>In time, this work will feed back into the ESB Configuration Editor, making it a lot easier to perform transformations (and other data manipulation processes) on the ESB.<br /></p><p></p></div>Tom Fennellyhttp://www.blogger.com/profile/14161465872732273475noreply@blogger.com2tag:blogger.com,1999:blog-8048607794005651608.post-32852316202148465302009-03-01T00:33:00.000-08:002009-03-01T00:41:29.614-08:00Integrating jBPM + JBoss ESB + POP3<a href="http://architecture-journal.blogspot.com/2009/02/quick-tip-integrando-jbpm-jboss-esb.html">POP3 JCA Inflow example</a>. It's in Portuguese. <a href="http://translate.google.ie/translate?u=http%3A%2F%2Farchitecture-journal.blogspot.com%2F2009%2F02%2Fquick-tip-integrando-jbpm-jboss-esb.html&sl=pt&tl=en&hl=en&ie=UTF-8">Here it is translated to English.</a>Tom Fennellyhttp://www.blogger.com/profile/14161465872732273475noreply@blogger.com2tag:blogger.com,1999:blog-8048607794005651608.post-80364951919598951822009-02-26T04:17:00.000-08:002009-02-26T04:27:20.185-08:00Smooks Persistence: Reusing your Hibernate, Ibatis and JPA resources to persist XML, EDI and moreMaurice Zeijen posted an very interesting blog on how to leverage existing Hibernate, JPA and Ibatis persistence resources to easily persist XML, EDI, CSV, JSON and more, using <a href="http://www.smooks.org">Smooks</a>.<br /><br />This functionality should eventually make its way into the ESB.<br /><br /><a href="http://blog.smooks.org/2009/02/26/smooks-persistence-part-1-the-introduction/">See the full blog here</a>. Don't forget to vote for it ;)Tom Fennellyhttp://www.blogger.com/profile/14161465872732273475noreply@blogger.com3tag:blogger.com,1999:blog-8048607794005651608.post-29938474044858579162009-02-24T05:56:00.001-08:002009-02-24T05:56:42.598-08:00Podcast on SOA PatternsIn case <a href="http://jboss-soa-p.blogspot.com/2009/02/soa-patterns-podcast.html">you don't read the SOA Platform blog</a> (why not?! ;)Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com2tag:blogger.com,1999:blog-8048607794005651608.post-69343353569957578922009-02-16T00:38:00.001-08:002009-02-16T00:40:55.505-08:00CICS integration with JBossESBWe've been working with <a href="http://www.legsem.com/legstar/">LegStar to integrate CICS through JBossESB</a>. <a href="http://www.infoq.com/articles/legacy-integration">InfoQ has recently published an article on the subject</a>, so check it out if you're interested in this situation.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com3tag:blogger.com,1999:blog-8048607794005651608.post-52239389123432510882009-02-15T02:51:00.000-08:002009-02-15T02:53:47.684-08:00JBossESB and CamelEdgar has <a href="http://www.jboss.org/feeds/post/combining_apachecamel_bsf_to_make_jboss_esb_polyglot">written a nice article on JBossESB 4.5 and Camel</a>. If you haven't seen it already, then check it out.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-65452070134711462092009-01-18T12:22:00.001-08:002009-01-18T12:23:54.130-08:00WSTF retrospectiveI forgot to mention that we've been working with IBM and others for a while on the <a href="http://www.wstf.org/">Web Services Test Forum</a>. For more information <a href="http://www.infoq.com/news/2008/12/wstf">take a look at the InfoQ article</a>.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com1tag:blogger.com,1999:blog-8048607794005651608.post-59113102284186742442009-01-18T12:18:00.000-08:002009-01-18T12:21:50.374-08:00SOA Design Patterns<a href="http://jbossesb.blogspot.com/2007/12/soa-patterns.html">About a year ago I mentioned that we were helping Thomas Erl with his (then) latest book on SOA Design Patterns</a>. Well <a href="http://www.amazon.com/Design-Patterns-Prentice-Service-Oriented-Computing/dp/0136135161">the book has been published</a>. For more information take a look at <a href="http://jboss-soa-p.blogspot.com/2009/01/soa-design-patterns.html">the SOA Platform blog entry</a>.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com0tag:blogger.com,1999:blog-8048607794005651608.post-40772868452452378132008-11-26T04:06:00.000-08:002008-11-26T04:07:15.336-08:00Smooks on InfoQOur very own Tom Fennelly has had a <a href="http://www.infoq.com/news/2008/11/smooks-events">great article on Smooks published on InfoQ</a>. Take a look.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com0tag:blogger.com,1999:blog-8048607794005651608.post-90064764016733310722008-11-21T01:33:00.000-08:002008-11-21T01:35:51.881-08:00StonehengeWe just helped start <a href="http://wiki.apache.org/incubator/StonehengeProposal">Apache Stonehenge</a>. As <a href="http://www.webservices.org/weblog/mark_little/web_services_interoperability_and_portability">I've said elsewhere</a> several times, interoperability is very important for Web Services, so hopefully this will help the industry as a whole as well as our projects.Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com0tag:blogger.com,1999:blog-8048607794005651608.post-14259057123012257912008-10-31T09:57:00.000-07:002008-10-31T09:59:18.301-07:00SOA Platform 4.3 is released!We're pleased to announce that <a href="http://www.redhat.com/jboss/platforms/soa/">version 4.3 of our SOA Platform</a> has just been released. We've made quite a few improvements since the <a href="http://www.redhat.com/about/news/prarchive/2008/jboss_soa.html">first release</a>, including <a href="http://www.redhat.com/about/news/prarchive/2008/SOA_JON.html">closer integration with JON</a> to provide runtime governance of services, improved Web Services support, better performance, reliability etc. SOA-P 4.3 GA is based on JBossESB 4.4 CP1, so you can grab the source from the repository. As always, give us feedback so we can improve it even more in subsequent releases!Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com3tag:blogger.com,1999:blog-8048607794005651608.post-2289795026594257362008-10-24T03:41:00.000-07:002008-10-24T03:46:25.530-07:00Wise as a JBoss project<a href="http://jbossesb.blogspot.com/2008/08/zero-code-web-services-addition.html">We've been working with the Wise project</a> for a while and it's offered us some really nice capabilities. So it's with great pleasure that I can now announce that <a href="http://jbosswise.blogspot.com/2008/10/wise-is-jbossorg-project.html">Wise has moved</a> to <a href="http://www.jboss.org/wise/">become a JBoss Project</a>. Welcome to the entire Wise community! I'm sure we've all got great things ahead!Mark Littlehttp://www.blogger.com/profile/15072917010265365428noreply@blogger.com2