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
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”;