RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Connecting RESTful Web Services to an ESB : Page 2

Need a strategy for connecting RESTful web services to an enterprise service bus (ESB)? Check out three integration tools that will enable you to reliably incorporate RESTful web services into ESB-backed integration solutions.

Specialized REST Adapter
Popular open source ESB products, such as Mule, provide REST adapters as part of their product offerings. Mule offers a REST wrapper that is very simple to set up and configure. Configuration steps include setting up all the common parameters that characterize the RESTful web service, such as URL, HTTP method type, query parameters, HTTP error handler, etc.

The following is an example of Mule's configuration file for the RESTful adapter, which invokes the RESTful web service presented in my previous DevX article "RESTful Web Services: The Keep-It-Simple Style":

  <mule-descriptor name="HTTPPostSample" implementation="org.mule.components.rest.RestServiceWrapper" 
singleton="false" initialState="started"> <inbound-router matchAll="false"> <endpoint address="stream://System.in" type="senderAndReceiver" /> </inbound-router> <outbound-router matchAll="false"> <router className="org.mule.routing.outbound.FilteringOutboundRouter" enableCorrelation="IF_NOT_SET"> <endpoint address="stream://System.out" transformers="XmlDecoder Xslt XmlToObject" type="senderAndReceiver" /> </router> </outbound-router> <properties> <property name="serviceUrl" value="http://mycompany.com/shipments/PrintShipmentRoute" /> <property name="payloadParameterName" value="shipment_id" /> <property name="httpMethod" value="GET" /> </properties> </mule-descriptor>

All other parameters such as payloadParameterName are optional, but the urlFromMessage parameter is of particular interest when integrating ESB Mule with canonical web services. With this parameter set, Mule ESB will look into a message for the value of the rest.service.url parameter, which represents the URL of the RESTful web service to be invoked.

This option enables Mule to access RESTful URLs that universally represent entities (e.g., shipment ID is part of the URL), which is in accordance with the best practices for RESTful web services.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date