Showing posts with label OSB. Show all posts
Showing posts with label OSB. Show all posts

Thursday, October 17, 2013

OSB - Remove Namespace using XQuery



Recently, we came across a requirement , where we need to remove name space of XML before we send to MQ. this case IBM I Series application is receiving data from processing .

This is very common requirements specially when we are integrating with legacy system.  In order to achieve functionality, I use below X-Query function. 

Name -RemoveNamespace

xquery version "1.0" encoding "Cp1252";
(:: pragma  parameter="$anyType1" type="xs:anyType" ::)
(:: pragma  type="xs:anyType" ::)

declare namespace xf = "http://www.officedepot.org/Order/Remove_Namespace/";

declare function xf:removeNamespace($e as element())as element()
{element { xs:QName(local-name($e)) }
{ for $child in $e/(@*,node())
 return  
 if ($child instance of element())
    then xf:removeNamespace($child)
       else $child
       }
 };

declare variable $e as element() external;

xf:removeNamespace($e)

Now, we need to use replace action in proxy message flow to execute this XQuery, 





In side Proxy Flow, add replace action

Select "Replace node contents" radio button
XQuery  Bind Variables should be $body . Please note , it is not  $body/* .


This will remove namespace elements from XML . Happy codding. :)

Thursday, July 14, 2011

OSB - Internal Server Error JMS Transaction rollback


This blog explain how to roll back a transaction in case of internal server errors in OSB. In general, if OSB proxy service gets any incorrect(404 HTTP Response) or there is an internal server error(500 HTTP response) from the transport the transaction will not roll back and message will lost. There seem to be some ambiguity among product designers on interpreting http spec and they decided to treat any response as a success.

Scenario

JMS Queue -> OSB Proxy Service -> OSB Business Service -> Failing Service

To resolve the issues, please flow below steps in OSB proxy service.

1) In Route node of routing options make Quality of Service as ‘"Exactly Once”


2) Enabled the Same Transaction for Response in the Proxy service which was listening to the JMS queue




3) The Connection Factory used to consume message from JMS queue should be XA enable (XA connection factory).

4) In JMS proxy Route Error handler do a raise error and Reply with Failure.

5) Enable XA required property for proxy service which is listening to JMS queue


Once you make these necessary changes in proxy services. Activate changes and retest the flow. now you can observer the transaction will roll back in case of ‘Internal server Error” J