XQuery vs. OSB

Hi everyone,
am I the only one who gets the impression that the XQuery support in the OSB Workshop is extremely basic?
I have two use cases that I can not really implement using the graphical designer: I convert from an instance of one XSD to another. I have a node which may appear any number of times (in the input document). The XQuery editor does not really recognize it (it states that it is exactly once) so when I map its children to another node in the target document (which may also appear any number of times) I do not get a cycle but rather a direct mapping.
Another problem I have is with the following structure:
tariff - exactly once
tariff * - any times
so something like:
<tariff>
<tariff>
<id>1</id>
</tariff>
<tariff>
<id>2</id>
</tariff>
</tariff>
This results in the XQuery editor showing only the innermost tariff element (as exactly once) and nothing else!
Can it be that such trivial use cases are not supported by the graphical editor? What other options of mapping data do I have? There is no graphical XSLT editor either so that does not seem to be an option.
Best regards,
Dimo

Ok, I understand. Back to your original question ... I don't think there is anything better then XQuery editor. It's not bad if you want some quick transformation code you can build on further.
For XSLT under Eclipse 3.5, I use Orangevolt XSLT plugin from http://eclipsexslt.sourceforge.net/update-site. It's not graphical, but very helpful for source editing. However, I'm not sure you can use it with Eclipse 3.3.2 (Workshop).

Similar Messages

  • Starting with XQuery and OSB

    Hi,
    I am new to OSB, can anyone please help me providing me some inputs to learn XQuery and OSB?
    Thanks in advance.
    Ankit

    Hi,
    For W3C,
    " [http://www.w3schools.com/xquery/default.asp] "
    " [http://www.w3.org/XML/Query/] "
    and for OSB
    [http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/tutorial/tutGettingStarted.html]
    [http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/consolehelp/index.html]

  • Help with XQuery in OSB

    Hi!
    I'm having trouble trying to build an XQuery expression in OSB. I defined a "do" action where I iterate over elements of XML. There I defined an assign action to get each Country Name element using expression "$query/Countryl[$index]/Name/text()" where $query contains following XML document and $index contains current index for each do iteration.
    <Countries>
    <Country>
    <Name>France</Name>
    </Country>
    <Country>
    <Name>UK</Name>
    </Country>
    </Countries>
    The problem is I'm getting same "France" value as expression result for every iteration. If I replace query with "$query/Countryl[1]/Name/text()" or "$query/Countryl[2]/Name/text()" then I get correct "France" and "UK" values.
    Could anyone give me any advice?
    Thank you in advance.

    I resolved it with $query/Countryl[xs:integer($index)]/Name/text()
    Thank you.

  • How to use a xquery in OSB Proxy service?

    I have created a xquery and added to alsb. I wanted to use it in a proxy service to replace an element in $body. How can i do it?

    Using Replace action in your proxy service flow:
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/eclipsehelp/tasks.html#wp1121647
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/eclipsehelp/ui_ref.html#wp1298470

  • How to get Database functions into xquery/XSLT in OSB 12c

    Hello All,
    How to make use of  functions orcl:sequence-next-val and orcl:query-database in xslt/xquery in OSB 12c.
    I need to do the below logic in xslt/xquery and used it in replace activity . But in OSB 12c I don't see these function. Request to provide me the solution to do it in OSB.
    XSLT in SOA
    <xsl:when test="/ns0:CreateEvent/ns0:Header/header:SourceName != &quot;&quot;">
                <ns1:googleEventSourceId>
                  <xsl:value-of select="orcl:query-database(concat(&quot;select google_event_source_id from enterprise.google_event_source where google_event_source=&quot;,&quot;'&quot;,/ns0:CreateEvent/ns0:Header/header:SourceName,&quot;'&quot;),false(),false(),&quot;jdbc/PRDatasource&quot;)"/>
                </ns1:googleEventSourceId>
              </xsl:when>
    <ns1:googleMapEventId>
              <xsl:value-of select="orcl:sequence-next-val(&quot;enterprise.google_map_event_seq&quot;,&quot;jdbc/PRDatasource&quot;)"/>
            </ns1:googleMapEventId>
    please see below code is just part of my transformation.
    Regards,
    TJ.

    bump

  • Xquery with bind variable in OSB

    Hi,
    I have requirement to read XML file in Xquery as bind variable but it's giving error. I have included this file in OSB proejct but i dont know how to point this out using bind variable. I tried to read file using fn:doc and given file name but it's giving error.
    Any pointer here..
    Thanks

    a few other threads :
    How to use fn:doc() in ALSB
    Re: OSB: How read file xml that is into project OSB
    Caching XML Variable in OSB
    things you need to look at :
    xquery files aren't customizable
    xquery files itself are cached, the fn:foc function will be executed every time again
    so if you don't use the xml for other things, i would just registrate it as xquery file with the xml in it
    or you could use the synchronous file adapter to retrieve the data from the file

  • Convertion of String to XML node using Xquery transformation in OSB

    How to convert string to XML node elementusing a built in function using Xquery transformation in OSB?

    check this out - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html
    if in SOA (BPEL & Mediator) you can use oraext:parseXML.
    you should thoroughly analyse where to implement your requirement as some good practices advise to implement more complex logic in SOA and leave OSB to only connect to the services' endpoints.
    Hope this helps,
    A.

  • How to call business service from xquery transformation in OSB ??

    Hi All,
    How to call business service from xquery transformation in OSB ??
    I need to assign the response variable of Business Service to a target element in XQuery Transformation Mapper file.
    It's urgent.
    Regards,
    Jyoti Nayak

    Transformation is to mapping the source and target of 2 different schemas.
    In your case you should have a XQuery transformation between, your Business Service output schema and the target schema.
    Thanks,
    Vijay

  • Validate date in Xquery version "1.0" to be used in OSB

    I have a requirement where i have to populate error code and messages if a date is invalid. For which I can use
    xquery version "1.0" encoding "Cp1252";
    (:: pragma bea:global-element-return element="Error" location="../../IDCardStatus/xsd/xsdError.xsd" ::)
    declare namespace xf = "http://tempuri.org/IDCardRequest/xq/DateValidation/";
    declare function xf:DateValidation($date as xs:string)
        as element(Error) {
    <Error>
    {if ((fn:concat(fn:substring($date,1,4),'-',fn:substring($date,5,2),'-',fn:substring($date,7,8))) castable as xs:date)
    then
    else
            <ErrorSeq>
            <ErrorCode>97534</ErrorCode>
      <ErrorMssg></ErrorMssg>
      </ErrorSeq>
    </Error>
    declare variable $date as xs:string external;
    xf:DateValidation($date)
    But castable is not implemented in Oracle Fusion Middleware Xquery implementation and Try Catch can be used if Xquery throughs error but are implemented in xquery version "3.0" and Oracle Fusion Middleware still uses version "1.0". Please Help as its a common requirement in most of the projects i have come along.Thanks in anticipation

    Sorry, I assumed you were using 12c.  OSB 11g supports the XQuery 1.0 W3C Working Draft from 23 July 2004 and also does not include the castable expression.  OSB 12c supports the full XQuery 1.0 recommendation (including the castable expression). 

  • Writing XQuery Expressions in XPath editor of OSB

    Hi All,
    I have conditional branch node in my OSB proxy.
    My requirement is
    My input element contains one of {A,B,C}
    if my input element contains one of {A,B} then one branch should executed
    if my input element contains C then other branch should executed.
    I could not achieve my 1st case because I could not specify OR condition in branch.
    Is there any other alternative. I wanted to use branch only.
    My approach is:
    I am trying to use XQuery in XPath editor of branchNode.
    This XQuery implements OR logic and returns string value which selects my A,B branch, but not sure if I can use XQuery in XPath editor
    Thanks,
    Praveen

    Hello,
    Try to put a stage with an assign before the branch, with:
    if (A or B)
    variableCondition = BRANCH-AB
    And in the branch put as condition the variable: variableCondition
    Hope this help you.
    Edited by: user13302387 on 07-mar-2012 4:49

  • XSLT and XQuery recommendation for BPEL and OSB

    Hi,
    1. Why is XQuery recommeded for OSB and XSLT for BPEL. Are there any specific performance optimization reason behind this.
    2. Apart from OSB and BPEL, both XSLT and XQuery has xml transformation options and creating HTML. What is the difference between these two.
    Thanks in advance!

    you can create the graphical view of Xquery in Eclipse but not for XSLT
    Xquery is much faster than XSLT in OSB.
    Through XSLT however you can achieve more complex transformation.
    OSB has its historic origins in BEA Aqalogic stable and so Xquery was widely used used even though XSLT is supported. It is a matter of choice(your standards in your organization,your developer skillsets,your re-usable libraries etc )
    In Jdeveloper you can develop xslt in graphical mode though and attain complex transformation

  • Problem with Xquery transformation in OSB

    hi,
    My scenario is that I have to break the data in a single tag of xml A, to populate multiple tags of xml B.I am using Xquery transformation and substring function to achieve this. The problem comes when i import the xquery resource in OSB and try to do the transformation in a proxy service it gives the following error
    <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
    <con:errorCode>BEA-382510</con:errorCode>
    <con:reason>
    *OSB Assign action failed updating variable "message": com.bea.wli.common.xquery.XQueryException: Error parsing XML: {err}XP0006: "element {http://schemas.xmlsoap.org/soap/envelope/}Body { {http://www.w3.org/2004/07/xpath-datatypes}untypedAny }": bad value for type element {http://www.example.org/data}data { {http://www.w3.org/2001/XMLSchema}anyType }*
    </con:reason>
    <con:location>
    <con:node>PipelinePairNode1</con:node>
    <con:pipeline>PipelinePairNode1_request</con:pipeline>
    <con:stage>stage1</con:stage>
    <con:path>request-pipeline</con:path>
    </con:location>
    </con:fault>
    the configuration i have done in the proxy service is this::_
    Assign: [XQuery resource..] to [message]
    Delete: [.] in [body]
    Insert [$message] [as first child of][.] in [body]
    The Xquery resource is the .xq file that i have generated for Xquery transformation.
    and i m routing this proxy service to a business service that wud take the XML and dump it to my D drive using file protocol.
    Edited by: rahulc on Oct 12, 2010 12:40 AM
    Edited by: rahulc on Oct 12, 2010 12:41 AM

    My Xquery is this::
    (:: pragma bea:global-element-parameter parameter="$data1" element="ns0:data" location="data.xsd" ::)
    (:: pragma bea:global-element-return element="note" location="note.xsd" ::)
    declare namespace ns0 = "http://www.example.org/data";
    declare namespace xf = "http://tempuri.org/OSB_Try/tag_break/";
    declare function xf:tag_break($data1 as element(ns0:data))
    as element(note) {
    <note>
    <to>
    fn:substring(data($data1),
    1 ,
    6)
    </to>
    <from>
    fn:substring(data($data1),
    7 ,
    6)
    </from>
    <heading>
    fn:substring(data($data1),
    13 ,
    6)
    </heading>
    <body>
    fn:substring(data($data1),
    19 ,
    11)
    </body>
    </note>
    declare variable $data1 as element(ns0:data) external;
    xf:tag_break($data1)
    and my data is this::
    <?xml version="1.0"?>
    <ns0:data xmlns:ns0="http://www.example.org/data">DON'T FORGET ME THIS WEEKEND!</ns0:data>
    and i have tested this zquery for the above data and this is the transformation its doing::
    <note>
    <to>DON'T </to>
    <from>FORGET</from>
    <heading> ME TH</heading>
    <body>IS WEEKEND!</body>
    </note>
    Edited by: rahulc on Oct 12, 2010 1:57 AM

  • 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

  • In OSB , xquery issue with large volume data

    Hi ,
    I am facing one problem in xquery transformation in OSB.
    There is one xquery transformation where I am comparing all the records and if there are similar records i am clubbing them under same first node.
    Here i am reading the input file from the ftp process. This is perfectly working for the small size input data. When there is large input data then also its working , but its taking huge amount of time and the file is moving to error directory and i see the duplicate records created for the same input data. I am not seeing anything in the error log or normal log related to this file.
    How to check what is exactly causing the issue here,  why it is moving to error directory and why i am getting duplicate data for large input( approx 1GB).
    My Xquery is something like below.
    <InputParameters>
                    for $choice in $inputParameters1/choice              
                     let $withSamePrimaryID := ($inputParameters1/choice[PRIMARYID eq $choice/PRIMARYID])                
                     let $withSamePrimaryID8 := ($inputParameters1/choice[FIRSTNAME eq $choice/FIRSTNAME])
                     return
                      <choice>
                     if(data($withSamePrimaryID[1]/ClaimID) = data($withSamePrimaryID8[1]/ClaimID)) then
                     let $claimID:= $withSamePrimaryID[1]/ClaimID
                     return
                     <ClaimID>{$claimID}</ClaimID>                
                     else
                     <ClaimID>{ data($choice/ClaimID) }</ClaimID>

    HI ,
    I understand your use case is
    a) read the file ( from ftp location.. txt file hopefully)
    b) process the file ( your x query .. although will not get into details)
    c) what to do with the file ( send it backend system via Business Service?)
    Also noted the files with large size take long time to be processed . This depends on the memory/heap assigned to your JVM.
    Can say that is expected behaviour.
    the other point of file being moved to error dir etc - this could be the error handler doing the job ( if you one)
    if no error handlers - look at the timeout and error condition scenarios on your service.
    HTH

  • OSB - XQuery - line 7, col 2: {err}FORG0005: expected exactly 1 item, got 0

    Hi,
    I am trying to execute the below sample XQuery. Eclipse designer does not show any error. However on executing the XQuery, I get the following error "+Error executing the XQuery transformation: line 7, column 2: {err}FORG0005: expected exactly one item, got 0 items+". Appreciate your help.
    xquery version "1.0" encoding "UTF-8";
    declare namespace xf = "http://tempuri.org/OSB%20Project%201/Ids/";
    declare function xf:Ids()
    as element() {*
    *     let $abc := <catalog><product dept="MEN"><number>784</number><name language="en">Cotton Dress Shirt</name><colorChoices>white gray</colorChoices><desc>Our favorite shirt!</desc></product></catalog>*
    *     for $product in $abc/catalog/product*
    *     let $name := $product/name*
    *     where $product/@dept = "ACC"*
    *     order by $name*
    *     return $name*
    xf:Ids()

    Thanks, for the answer.
    I just tweeked my XQuery:Var = $abc a little and ended up with same issue. Request your help again.
    xquery version "1.0" encoding "UTF-8";
    declare namespace xf = "http://tempuri.org/OSB%20Project%201/Ids/";
    declare function xf:Ids() as element(*)? {
    let $abc := +<catalog><product dept="MEN" xmlns="http://datypic.com/prod"><number>784</number><name language="en">Cotton Dress Shirt</name><colorChoices>white gray</colorChoices><desc>Ou<i>favorite</i> shirt! </desc></product><product dept="ACC"><number>563</number><name language="en">Floppy Sun Hat</name></product><product dept="ACC"><number>443</number><name language="en">Deluxe Travel Bag</name></product><product dept="MEN"><number>784</number><name language="en">Cotton Dress Shirt</name><colorChoices>white gray</colorChoices><desc>Ou<i>favorite</i> shirt! </desc></product><product dept="WMN"><number>557</number><name language="en">Fleece Pullover</name><colorChoices>navy black</colorChoices></product></catalog>+
    --(:<catalog><product dept="ACC"><number>784</number><name language="en">Cotton Dress Shirt</name><colorChoices>white gray</colorChoices><desc>Our favorite shirt!</desc></product></catalog>:)--
    for $product in $abc/product
    let $name := $product/name
    where $product/@dept = "ACC"
    order by $name
    return $name
    xf:Ids()

  • Is there a way to use a OSB variable into an XQuery Transformation?

    Hi,
    I´m trying to access to a variable that I declared in the OSB with an Assign, but I´m gettin and Error that the variabe is used but not declared, I also tried to use a OSB variable like $messageID and still have the same Error, has somebody used a previous declared variable into an XQuery Transformation?
    Thanx in Advanced!
    Kind Regards!

    Hi,
    In order to use a varible into a XQuery transformation you need to declare it as an input.
    When you are defining the source types (in the 'new XQuery Transformation' wizard) you should add the variable that you want to use.
    So if you assigned a variable called messageId and you want to use it in your message transformation using a XQuery resource you should add the following in the source types screen:
    - On the Available source targets click 'XML' and then select the xml message that you want to transform and click 'Add'
    - On the Available source targets click 'Simple' and then select 'string' and click 'Add'
    This should declare the xml that you want to transform and the variable that you want to use during the transformation.
    Hope it helps.
    Regards,
    Rodrigo

Maybe you are looking for