Friday, August 7, 2015

Reading XML/Xquery (Password) file in OSB

Some days back, I came across a case where I need to pass the Username/password to target system in header of soap message, which will authenticate the request. This authentication will be used in lots of OSB services so can't be hard coded in each service as it will be big maintenance task in case of credentials change.

I got two ways to achieve this, probably third will come soon where my colleague is working.

First : Store details in XML/Xquery file and use it while doing header transformation.

  • Create a dummy xquery (.xq file) to save the details as below

declare namespace ns0 = "http://www.example.org/passwordDetail";
declare namespace xf = "http://tempuri.org/xmlLookup/passwordDetail/";

declare function xf:passwordDetail($password1 as element(ns0:password))
    as element(ns0:password) {
        sotiPassword
};
  • Read this .xq and assign to a variable using Assign Activity.
  • Use Replace activity to update header as below
  • Deploy and see the result as below



I will explain the second approach in my next blog here.

No comments: