OSB: Calling XQuery from XQuery function

Hi,
In OSB, is it possible to call XQuery functions from an XQuery. I have a number of XQuery files (.xq) and I want to call them from another xquery file, is that possible. I tried calling directly but it didn't work. Is there a way?
Thank you
Matt

Matt,
To use custom XPATH/XQuery functions, you need to register them into OSB runtime. Please refer -
http://docs.oracle.com/cd/E21764_01/doc.1111/e15866/custom_xpath.htm#OSBDV1725
http://eelzinga.wordpress.com/2010/05/10/oracle-service-bus-11g-using-custom-xpath-functions/
Regards,
Anuj

Similar Messages

  • XML Error while calling webservice from oracle function.

    I am getting an error while I am trying to call webservice from oracle function. Any ideas? Thanks.
    select get_new_string ('proxy:80', 'http://xxx/PatternVariations/SourceTest/WebMethods','Scott') from dual
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00225: end-element tag "H4" does not match start-element tag "P"
    Error at line 9
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at "DORSBP00.DEMO_SOAP", line 82
    ORA-06512: at "DORSBP00.GET_NEW_STRING", line 11

    The error message implies that the web service is returning something that is not well formed xml. Can you verify what is being returned by the web service call

  • Error when calling webservice from oracle function.

    Hi,
    I am getting following error when i am trying to call webserivce from oracle function. Please can anyone suggest the required solution. Below is the error obtained.
    Thanks.
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00225: end-element tag "UL" does not match start-element tag "P"
    Error at line 15
    ORA-06512: at "SYS.XMLTYPE", line 54
    ORA-06512: at "SCOTT.DEMO_SOAP", line 87
    ORA-06512: at "SCOTT.WEB_SERVICE", line 17

    The error message implies that the web service is returning something that is not well formed xml. Can you verify what is being returned by the web service call

  • Error while calling XQuery Function with xs:date type as Argument

    Hi,
    I have follwing function in my DataService .
    declare function tns:getXXXDetail($effectiveDate as xs:date,
    $cancelDate as xs:date) as element(ns26:XXXAccount)* {
              implCode
    declare function tns:testGetXXXDetail($searchCriteria as element(ns15:locateMemberXXXDetail))
                   as element(ns26:XXXAccount)* {
    for $Account in tns:getXXXDetail($searchCriteria/ns16:accountTypeDates/ns18:effectiveDate,
         $searchCriteria/ns16:accountTypeDates/ns18:cancelDate)
    return $Account
    I am trying to test the getXXXDetail() function from testGetXXXDetail .
    The searchCriteria is a complex type with date elements effectiveDate and cancelDate, both are optional
    When i test with effectiveDate,cancelDate elements present in $searchCriteria its working fine.
    When i remove these dates element i am getting follwing error
    "expected exactly one item, got 0 items" error
    Any Clue ?

    When i remove these dates element i am getting follwing error"expected exactly one item, got 0 items" error
    Sounds like your schema for these items indicates minOccurs="1" (or relies on that as the default).
    Edit the schema and change the definitions to be...
    <xs:element name="effectiveDate" minOccurs="0" ... />

  • PLS-00201 when trying to call ORA_HASH from a function

    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for Solaris: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    SQL> select ora_hash('GOOBERS') from dual;
    ORA_HASH('GOOBERS')
    1552467184
    SQL> create or replace function my_hash(x in varchar2) return number is begin return ora_hash(x); end;
    2 /
    Warning: Function created with compilation errors.
    SQL> show errors
    Errors for FUNCTION MY_HASH:
    LINE/COL ERROR
    1/56 PL/SQL: Statement ignored
    1/63 PLS-00201: identifier 'ORA_HASH' must be declared
    If anyone has some ideas on this it would be great to hear from you. Thanks.

    Thanks Maxim & Rakesh, that worked.
    It does look like a bug. The return on it's own works with other functions e.g. ASCII etc. but not ORA_HASH.
    The select from dual version is painfully slow (e.g. 25 x times) though so I think I'll use dbms_utility.get_hash_value instead for now. I was planning to use that version in 9i anyway as my app still needs to run on 9i - but I was trying to get the ORA_HASH working for 10g as it is incredibly fast.
    Will definitely log it though.

  • Exiting from SQLPLUS on failure returned from a function

    I am working on Oracle 11g (R2). I want to call a function in package and if that function returns zero then I want to quit/exit from SQLPLUS prompt.
    I will be calling that function of package from an .sql file.
    How can i do this?
    I can also call raise_application_error() from that function. Without using WHENEVER SQLERROR EXIT, is there any way of doing this?

    Thanks, but if i am calling that function from a .sql file, can i verify the return value and exit from sqlplus prompt.

  • OSB: How to recreate reusable XQuery functions

    OSB's XQuery implementation does not support the XQuery "module" which allows the creation of a function library so how can OSB provide function re-use?
    I know you can create XQuery transformations that can be called but these always need a "body" that makes a specific call so I'm finiding I have to copy useful XQuery functions from one transformation to another. Ideally I should be able to call an XQuery function external to the transformation.
    Does anyone have any pointers on this or is it a fundamental limitation of the OSB XQuery implementation?
    regards

    What we did is creating a seperate project in which we use most of XQuery stuff, using SaxonSA library to run and validate the queries.
    This project adds the following possibilities for xqueries:
    - Schema validation of XPath used in XQueries (including namespaces)
    - XQuery syntax validation (with errors at the exact line and position where it fails.
    - Allows the use of modules
    - Reqression testing XQueries
    Regrettably we can not do Java callout's from XQueries as this is not supported on the ESB.
    We also build a simple 'flattener' that takes a module based, schema enriched XQuery and then generates the XQuery that can be used on the ESB itself. The flattened query is also regression tested.
    Although it was quite some work to make it, it already has paid back the initial costs of the project in the second or third project we did. We since then have enhanced the project so it also can do regression message flow validation on the OSB (we already had valid input and output messages).
    The tool also greatly improves the stability of the code on the OSB, and reduces development time as we can build the XQuery from a unit test environment that will point out typos and other xpath related problems.
    We do have some fairly complex xqueries on the OSB, the number of xqueries in the project at the moment is 187 with 250 unittests.
    So, if Oracle is not going to include it in the OSB itself (which seems lilkely at the moment), you can build such a system yourself !
    Wim Veldhuis,
    PharmaPartners BV

  • Including customized xquery functions in XQuery/XSLT expression Editor-OSB

    Hi,
    I have written a customized xquery function. I want this to be included in the List of Xquery Functions which is displayed by Oracle Service Bus in the XQuery/XSLT
    Expression Editor. OSB displays the built in xquery functions in the XSLT/Xquey Expression Editor. Is there any way to add the customised xquery to this list, so that it can be dragged and dropped later?
    Thanks,
    Balaji.

    I doubt if that is exposed out side of Oracle Engineering (Not public/documented). Please raise a support ticket for enhancement. If PM should concur you might get the steps that need to be performed for this feature.
    Thanks
    Manoj
    Edited by: Manoj Neelapu on Jun 8, 2010 8:37 AM

  • Passing a node to Xquery function

    Hi All,
    I have two functions in my xquery. I'm trying to pass a node from one function to another function to check if it exists and do some processing on the text that is present in that node (if exists).
    declare function appendLines($node as element()) as xs:string {
         if(fn:exists($node) and $node/text() ne "") then
              fn:concat($node/text(),", ")
         else (
    appendLines($LINE_ITEM/ns0:STATXT)
    Is the above call to that function is correct?
    Thanks!!!

    declare function appendLines($node as node()*) as xs:string {
              if(fn:exists($node)) then
                   if(fn:string-length(fn:normalize-space($node/text())) > 0) then (     
                        fn:concat($node/text(), " ")
                   else (
              else (
    It worked with the above function.

  • XQuery function : Adding day to current date

    I have a requirement to add 1 day to the current date during the Xquery transformation.
    Does anyone know if there is any xquery function that does that?
    From this link,
    http://download.oracle.com/docs/cd/E13214_01/wli/docs92/xref/xqdtopref.html#wp1162860
    it seems like there is a function, op: add-yearMonthDuration-to-dateTime, that serve this purpose, but I don't find it in OSB console IDE nor OEPE.

    You can use the below expression for adding 1 day (24 hrs) to a given current date:
    fn:current-dateTime() + xdt:dayTimeDuration("PT24H")
    Thanks,
    Patrick

  • OSB 10gr3 XQuery with CDATA - how to best do this?

    Hi There,
    I am writing an XQuery function to transform from one schema to another. My target schema has an attribute that is a string (xs:string), but the related protocol uses is for embedding another XML schema. Therefore I would like to treat the embedded value as an XML document using the CDATA command. I have tried using fn:concat and fn-bea:serialize but they do not work. There was an older thread :
    Returning CDATA using XQuery in ALSB
    in which the fn:inline is suggested, but this is not a valid function in the OSB10gR3 version.
    Can somebody provide me with an idea about how to use CDATA in an xquery ? Here is an example of the non-working fn:concat implementation:
    <ns0:abcRequest>
    <ns0:abcRequest>
    {fn:concat("<![CDATA[") }
    { $abcMessage/@* , $abcMessage/node() }
    {fn:concat("]]>") }
    </ns0:abcRequest>
    <ns0:abcEgmId>{ xs:string( $abcEgmId ) }</ns0:abcEgmId>
    <ns0:abcHostId>{ xs:int( $abcHostId ) }</ns0:abcHostId>
    </ns0:abcRequest>
    Any ideas for OSB 10g R3 would be much appreciated.
    Thanks,
    David.

    Hi Anuj,
    The serialize function does not escape the contents properly. It converts ">" to "Ambersand-G-T-Semicolon" (I had to spell them out since this forum had converted the characters back to the greater than symbol). I need to have the embedded CDATA and XML document untouched for subsequent processing on the side of the SOAP Provider (which I have no control over).
    So I want to achieve:
    <xmlElement>
    <innerElement><![CDATA[<myEmbeddedXML><nextedElement>....</myEmbeddedXML></nextedElement>]]>
    </xmlElement>
    Does this make sense ?
    Thanks,
    David.
    Edited by: user10313579 on Oct 27, 2010 9:30 PM

  • Retrieving Principal Name (=User Id) via XQuery Function

    I'm using a custom identity asserter within my WLS to create the security context.
    The OSB documentation states, that there is a XQuery function to read the user id from the security context: fn-bea:userid (see XQuery Implementation - 11g Release 1 (11.1.1.7)). Note: I have noticed that Oracle makes a distinction between Function Extensions from Oracle Service Bus and Supported Function Extensions from Oracle a.k.a Oracle’s XQuery Implementation).
    When using this XPath function in my OSB installation I receive the following error: {bea-err}SYS001: This functionality has not been implemented (sorry) operator [QName {http://www.bea.com/xquery/xquery-functions}userid]
    My questions:
    - Is this the correct function to read the user id/user name/principal information from the security context?
    - If it is, how can I make that function run in my OSB Domain? Is there a component I need to include/reference?
    - If not, what other options do I have? What is best practice? (e.g. Java Callout & accessing the HttpServletRequest object via Java?)
    Many thanks in advance.

    In OSB you can use fn-bea:lookupBasicCredentials($arg-string) function for the same.
    Here is the referece: XQuery Implementation - 11g Release 1 (11.1.1.6.3)

  • Xquery function in pl sql

    Hi all.
    Is some body know can XQuery functions be used/declared in pl sql? More deep, can I cover XQuery function by pl sql function or procedure? And how to input parameters/variables to Xquery function from pl sql?
    Any links to manual will be helpful.
    Best regards,
    Anton.

    Something like that?:
    SQL> create or replace procedure index_scan (index_name varchar2, name varchar2)
    as
       xml   xmltype;
    begin
       select xmlquery (
    if ("article-by-title" = $index_name) then doc("/wiki")/root/page[title=$name]
    else if ("article-by-id" = $index_name) then doc("/wiki")/root/page[id=$name]
    else if ("link-by-target" = $index_name) then doc("/wiki")/root/page/links/link[@target = $name]
    else if ("article-by-cat" = $index_name) then doc("/wiki")/root/page/catlinks/catlink[@target=$name]
    else error(fn:QName("http://www.w3.org/2005/xqt-errors",  $index_name) , "Some error occured") '
                 passing index_name as "index_name", name as "name"
                 returning content)
         into xml
         from dual;
    end index_scan;
    Procedure created.
    SQL> exec index_scan('My Index Name','My Name')
    BEGIN index_scan('My Index Name','My Name'); END;
    Error at line 20
    ORA-19112: error raised during evaluation: :My Index Name
    Detail: Some error occured
    ORA-06512: at "MICHAEL.INDEX_SCAN", line 5
    ORA-06512: at line 1Don't have your resources - therefore the error!

  • Does OSB support XQuery import module feature ?

    In OSB version 11.1 and Oracle Weblogic Server Version: 10.3.6.0
    I need to create library of XQuery functions (reusable components), to achieve this, I need to use XQuery import module feature.
    When I tried to use it, I got this error message ‘Module feature not supported (sorry)’ …
    Does OSB support XQuery import module feature ?

    You may like to refer Eric's blogpost -
    http://www.xenta.nl/blog/2011/10/19/oracle-service-bus-the-number-of-parameters-for-registered-xquery-resource-system1_to_fault-does-not-match-that-given-to-it-at-runtime/
    Basically, if you are not using a parameter in XQuery then it will not be registered.
    Regards,
    Anuj

  • Fault propagation from Composite - OSB - Caller

    Good morning
    I'm trying to implement a OSB as virtualizer from some composite services. For that I have connected the composite via direct binding to the OSB and created a OSB project where I import from URL the composite db WSDL and dependencies and create a Business Service over it. After that I'm creating a proxy service over the created business service automatically.
    Everithing works fine in the happy cenario, but the problem is when a business exception configured in the composite occurs.
    For example, in this composite I have schematron validation that validate if some fields are correct or not. In case of miss function a ValidationError is thrown.
    If I'm calling directly the composite for example from SOAPUi I get the schematron configured fault with:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header/>
    <env:Body>
    <env:Fault xmlns:fpre="urn:affinity.xxx.xxx.xxxx.xx">
    <faultcode>fpre:internalFault</faultcode>
    <faultstring/>
    <faultactor/>
    <detail>
    <ns1:ValidationErrors xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:ns1="http://xmlns.oracle.com/pcbpel/validationservice" xmlns:urn="urn:affinity.xxx.xx.xxxx.xx">
    <error>affinity.validation.name.en.mandatory</error>
    <error>affinity.validation.name.fr.mandatory</error>
    <error>affinity.validation.name.nl.mandatory</error>
    <error>affinity.validation.scope.mustBeInternalOrExternal</error>
    </ns1:ValidationErrors>
    </detail>
    </env:Fault>
    </env:Body>
    </env:Envelope>
    But when calling via OSB I get:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <soapenv:Fault>
    <faultcode>soapenv:Server</faultcode>
    <faultstring>BEA-380001: {urn:affinity.xxxxx.xxx.xx}internalFault</faultstring>
    *<detail>*
    *<con:fault xmlns:con="http://www.bea.com/wli/sb/context">*
    *<con:errorCode>BEA-380001</con:errorCode>*
    *<con:reason>{urn:affinity.xxxxx.xxx.xx}internalFault</con:reason>*
    *<con:location>*
    *<con:node>RouteTo_bc-core-affinity-service-bs</con:node>*
    *<con:path>response-pipeline</con:path>*
    *</con:location>*
    *</con:fault>*
    *</detail>*
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>
    Can someone help me how can I get the fault propagated to the details instead of the OSB fault ?
    Thanks

    This is because when OSB encounters a fault, the flow enters the exception pipeline which is composed of stage (or route )error handlers, service error handler and then system error handler. The sequence of flow is :
    stage ( or route error handler) --> service error handler --> system error handler.
    If some handler is not available, the error is automaticlly propogated to the next handler in the chain. So all errors goes to system error handler unless you specify a reply action within one of the intermediate error handler in which case further flow down the exception pipeline is suspended. System error handler is out of your control and if error reaches here, OSB generates its own fault and replaces the existing one. So if you want to have control make sure the fault is not propogated to the system error handler
    Best place to view the exception sequence flow is the trace viewin the test console

Maybe you are looking for

  • Bug in default photo lib. application (iPad2)

    Hello, today took photos of my daughter. Usually I take HD photos from a professional camera and transfer them to a default photo library to view and store for good. But I've discovered a bud when viewing photos when full zoomed out: right in the mid

  • How to get Adobe Reader to work in browsers on linux

    I am running LMDE 64 bit on one PC and a X-enabled Ubuntu Server installation on another (also 64 bit). Is it possible, under either of these scenarios to get Adobe Reader plugin to work on any browser? I need to access pdf files using Adobe Reader i

  • ITunes constantly freezes when opening, no error message

    Please help! ITunes has been working fine. One day I opened it and it got stuck on the default of opening up the music store. The only way I can get out of it is CtlAltDel. There is no error message. I have installed & re-installed it numerous times

  • Publish and Share Settings for Storing on Amazon S3 and linking on blog, in autoresponder, etc

    I want to publish/share my Premiere Elements 11 video such that I can store it on Amazon S3 and then link to it in my blog, facebook, autoresponder. I know I DON"T want the Online settings because I am not directly uploading to YouTube, etc.  There a

  • Left alt key not working all the time

    the left alt key seems to be intermittent on versions of windows vista and above using a MS wireless keyboard I don't know about you but the left alt key is very important in my workflow and it works intermittently It seems to be something with the d