1
votes

in Weblogic Service Bus 10g, I have an XQuery file with a function which I would like to utilize from within another XQuery file's function. How can I achieve this in OSB?

Projects/projectA/getMessageType XQuery:

declare namespace xf = "http://tempuri.org/projectA/getMessageType/";

declare function xf:getMessageType($anyType as element())
    as xs:string {

    ...
};

declare variable $anyType as element() external;

xf:getMessageType($anyType)

Projects/projectB/process XQuery:

declare namespace xf = "http://tempuri.org/projectB/process/";

declare function xf:process($data as element())
    as element() {

    // call projectA's getMessageType($data) here!!!
    ...
};

Thanks in advance, PM

1

1 Answers

2
votes

You would need to play the xf:getMessageType function from projectA into a library module as opposed to a main module. You could then import the library module.

Consider something like:

Projects/projectA/getMessageType XQuery:

import module namespace common = "http://your.site.com/common";

declare namespace xf = "http://tempuri.org/projectA/getMessageType/";
declare variable $anyType as element() external;

common:getMessageType($anyType)

Projects/projectB/process XQuery:

import module namespace common = "http://your.site.com/common";

declare namespace xf = "http://tempuri.org/projectB/process/";

declare function xf:process($data as element())
    as element() {

    common:getMessageType(data)
    ...
};

Projects/common/common.xqy

module namespace common = "http://your.site.com/common";

declare function common:getMessageType($anyType as element())
    as xs:string {

    ...
};

You may need to add an at statement to the import module statement, specifying the file location of the common library module, but I am not sure what that would look like exactly in WebLogic OSB.