Advertisements
RSS

Use XQuery with fn-bea:lookupBasicCredentials

02 Feb

This is an example XQuery which uses 2 simple custom functions and the fn-bea:lookupBasicCredentials to retreive information from a Service Account in the Oracle Service Bus. This to prevent the usage of cleartext passwords in the Oracle Service Bus.


declare namespace funcRBX = "http://www.rubix.nl/local"

declare function funcRBX:getUsername($inputPath as xs:string) as xs:string
{
  let $data := fn-bea:lookupBasicCredentials($inputPath)
  return
    if (exists($data/con:username/text()))
    then $data/con:username/text()
    else ""
};

declare function funcRBX:getPassword($inputPath as xs:string) as xs:string
{
  let $data := fn-bea:lookupBasicCredentials($inputPath)
  return
    if (exists($data/con:password/text()))
    then $data/con:password/text()
    else ""
};

declare function xf:defineConnection() as element(ns0:ConnectionHeader)
{
  <ns0:Connection>
    <ns0:host>ftp.myserver.locaL</ns0:host>
    <ns0:port>21</ns0:port>
    <ns0:username>{funcRBX:getUsername("MyOSBProject/serviceaccounts/SA_FTP")}</ns0:username>
    <ns0:password>{funcRBX:getPassword("MyOSBProject/serviceaccounts/SA_FTP")}</ns0:password>
    <ns0:protocol>FTP</ns0:protocol>
  </ns0:Connection>
};

hope it helps

Advertisements
 
1 Comment

Posted by on 02-02-2012 in OSB, XQuery

 

Tags: , ,

One response to “Use XQuery with fn-bea:lookupBasicCredentials

  1. rs

    04-06-2013 at 10:07

    This article is good. But please add the namespace
    declare namespace con =”http://www.bea.com/wli/sb/services/security/config”;

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: