Xquery Transformation with filter

Hi,
I am trying to implement a specific transformation: I need to filter an object on a key.
As input, I have this structure :
<STRUCTURE>
  <item>   // multiplicy : *
    <MONTH>
    <INDICATOR />
    <LETA/>
  </item>
</OBJECT_1>
<OBJECT_2>
  <item>   // multiplicy : *
    <ORDER_NUMBER/>
    <ORDER_LINE_NUMBER/>
    <MONTH />
  </item>
</OBJECT_2>
</STRUCTURE>
Here is an example :
<STRUCTURE>
   <OBJECT_1>
      <item>
         <MONTH>2013_M06</MONTH>
         <INDICATOR>ABC</INDICATOR>
         <LETA>2012-04-24</LETA>
      </item>
      <item>
         <MONTH>2013_M05</MONTH>
         <INDICATOR>DEF</INDICATOR>
         <LETA>2012-04-24</LETA>
      </item>
   </OBJECT_1>
   <OBJECT_2>
      <item>
         <MONTH>2013_M06</MONTH>
         <ORDER_NUMBER>11111</ORDER_NUMBER>
         <ORDER_LINE_NUMBER>1</ORDER_LINE_NUMBER>
      </item>
      <item>
         <MONTH>2013_M06</MONTH>
         <ORDER_NUMBER>11111</ORDER_NUMBER>
         <ORDER_LINE_NUMBER>2</ORDER_LINE_NUMBER>
      </item>
      <item>
         <MONTH>2013_M05</MONTH>
         <ORDER_NUMBER>22222</ORDER_NUMBER>
         <ORDER_LINE_NUMBER>1</ORDER_LINE_NUMBER>
      </item>
   </OBJECT_2>
</STRUCTURE>
I need to have this result :
<targetStructure>
   <object1>
         <month>2013_M06</month>
         <indicator>ABC</indicator>
         <leta>2012-04-24</leta>
          <object2>
             <orderNumber>11111</orderNumber>
             <orderLineNumber>1</orderLineNumber>
          </object2>
          <object2>
             <orderNumber>11111</orderNumber>
             <orderLineNumber>2</orderLineNumber>
          </object2>
      </object1>
      <object1>
         <month>2013_M05</month>
         <indicator>DEF</indicator>
         <leta>2012-04-24</leta>
         <object2>
             <orderNumber>22222</orderNumber>
             <orderLineNumber>1</orderLineNumber>
          </object2>
      </object1>
   </object1>
</targetStructure>
My XQ transformation is like this :
(:: pragma bea:global-element-parameter parameter="$STRUCTURE" element="ns1:STRUCTURE" location="xxx" ::)
(:: pragma bea:global-element-return element="ns0:targetStructure" location="xxy" ::)
declare namespace ns1 = "urn:aa";
declare namespace ns0 = "http://vvv.com";
declare namespace xf = "http://tempuri.org/cc/";
declare function xf:myTransformation($z_STRUCTURE1 as element(ns1:STRUCTURE))
    as element(ns0:targetStructure)
<targetStructure>
                    for $item in $z_STRUCTURE1/ns1:OBJECT_1/ns1:item
                    return
                        <object1>
                                for $MONTH in $item/ns1:MONTH
                                return
                                    <month>{ data($MONTH) }</month>
                                for $INDICATOR in $item/ns1:INDICATOR
                                return
                                    <indicator>{ data($INDICATOR) }</indicator>
                                for $LETA in $item/ns1:LETA
                                return
                                    <month>{ data($LETA) }</month>
                                for $item0 in $STRUCTURE/ns1:OBJECT_1/ns1:item
                                return
                                    <object2>
                                           for $ORDER_NUMBER in $item/ns1:ORDER_NUMBER
                                           return
                                                 <orderNumber>{ data($ORDER_NUMBER) }</orderNumber>
                                          for $ORDER_LINE_NUMBER in $item/ns1:ORDER_LINE_NUMBER
                                          return
                                               <orderLineNumber>{ data($ORDER_LINE_NUMBER) }</orderLineNumber>
                                   </object2>
</targetStructure>
As you can see, I got all object2 in each object1, while I only need the object2 where the MONTH is equal to the object1 one...
I tried to replace line 32 by
for $item0 in $STRUCTURE/ns1:OBJECT_1/ns1:item[ns1:month=$item/ns1:MONTH/text()]
... or some declinaisons, but I never got what I expected...
Any ideas ?
Regards

Use the below xquery:-
xquery version "1.0" encoding "Cp1252";
(:: pragma  parameter="$anyType1" type="xs:anyType" ::)
(:: pragma  type="xs:anyType" ::)
declare namespace xf = "http://tempuri.org/OSB%20Project%201/XQ/Test2/";
declare function xf:Test2($anyType1 as element(*))
    as element(*) {
       let $input:= <STRUCTURE> 
   <OBJECT_1> 
      <item> 
         <MONTH>2013_M06</MONTH> 
         <INDICATOR>ABC</INDICATOR> 
         <LETA>2012-04-24</LETA> 
      </item> 
      <item> 
         <MONTH>2013_M05</MONTH> 
         <INDICATOR>DEF</INDICATOR> 
         <LETA>2012-04-24</LETA> 
      </item> 
   </OBJECT_1> 
   <OBJECT_2> 
      <item> 
         <MONTH>2013_M06</MONTH> 
         <ORDER_NUMBER>11111</ORDER_NUMBER> 
         <ORDER_LINE_NUMBER>1</ORDER_LINE_NUMBER> 
      </item> 
      <item> 
         <MONTH>2013_M06</MONTH> 
         <ORDER_NUMBER>11111</ORDER_NUMBER> 
         <ORDER_LINE_NUMBER>2</ORDER_LINE_NUMBER> 
      </item> 
      <item> 
         <MONTH>2013_M05</MONTH> 
         <ORDER_NUMBER>22222</ORDER_NUMBER> 
         <ORDER_LINE_NUMBER>1</ORDER_LINE_NUMBER> 
      </item> 
   </OBJECT_2> 
</STRUCTURE>
let $month := fn:distinct-values($input/OBJECT_1//MONTH/text())
let $out:=<targetStructure>{
  for $x in 1 to fn:count($month)
  return
  <object1>
  <month>{$month[$x]}</month>
  <indicator>{$input/OBJECT_1/item[./MONTH=$month[$x]]/INDICATOR/text()}</indicator>
  <leta>{$input/OBJECT_1/item[./MONTH=$month[$x]]/LETA/text()}</leta>
  {for $y in $input/OBJECT_2/item
  where $y/MONTH/text()=$month[$x]
  return
  <object2>
  <orderNumber>{$y/ORDER_NUMBER/text()}</orderNumber>
  <orderLineNumber>{$y/ORDER_LINE_NUMBER/text()}</orderLineNumber>
  </object2>}
  </object1>
</targetStructure>
return $out
declare variable $anyType1 as element(*) external;
xf:Test2($anyType1)

Similar Messages

  • How to transform with xquery from CDATA to XML

    Hi everyone
    I want to transform from CDATA to XML and I don´t know how to do.
    anyone can help me please?
    I'm using OSB OEPE PS3, I have artifacts: person.PROXY, person.BIZ, BIZ-Person.WSDL, PROXY-Person.WSDL, Person-response.xq and Person.xsd.
    I Use Message Flow Within Route, Routing (Request and Response Actions)
    To Request Xquery transformation is ok, for Response Action I need help. I receive a String and inside with CDATA:
    +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+
    +<soapenv:Body>+
    +<executeResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">+
    +<executeReturn xsi:type="xsd:string">+
    +*<![CDATA[<example-data rows="1"><person><id>123</id><name>JHON</name><surname>MAGNESS</surname>+*
    *+<code>123456789V</code></person></example-data>]]>+*
    +</executeReturn>+
    +</executeResponse>+
    +</soapenv:Body>+
    +</soapenv:Envelope>+
    I want to map from CDATA to XML like this (Person.xsd):
    <xs:schema xmlns="http://www.domain.com/XSD/Persons" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.domain.com/XSD/ABCD" targetNamespace="http://www.domain.com/XSD/Persons" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:import namespace="http://www.domain.com/XSD/ABCD"
    <xs:complexType name="Persons">
              <xs:sequence>++
                   <xs:element name="id" type="xs:string"/>
                   <xs:element name="surname1" type="xs:string" minOccurs="0"/>
                   <xs:element name="surname2" type="xs:string" minOccurs="0"/>
                   <xs:element name="name" type="xs:string" minOccurs="0"/>
                   <xs:element name="code" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
    Edited by: user10070593 on Aug 29, 2012 10:58 PM
    Edited by: user10070593 on Aug 29, 2012 10:58 PM
    Edited by: user10070593 on Aug 29, 2012 11:00 PM

    Hey Patrick / Vlad thank you very much for your help :)
    I have solved it like this:
    Within my proxy in Message Flow (*using Routing -- Route -- Response Action*)
    I'm using the elements Assing and Replace
    In Assing element (expression: Person-response.xq, variable: varBStoPS)
    In Replace element (xpath : executeResponse/executeReturn/text() , in Variable: body, expression:
    *$varBStoPS*)
    Now, within Person-Response.xq , I am using the parameter: *$anyType1*, but this is a string, I don´t know to use a FOR loop in Xquery, as I can apply it to the XML mapping (Person.xsd)?, Knowing I get the list:
    *+<example-data rows="1"><person><id>123</id><name>JHON</name><surname>MAGNESS</surname>+*
    *+<code>123456789V</code></person></example-data>+*
    Person.xsd:
    <xs:element name="processResponse">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="ns1:HeaderMsgABCD"/>
                        <xs:element name="bodyResponse">
                             <xs:complexType>
                                  <xs:sequence>
                                       <xs:element name="PersonsCollection">
                                            <xs:complexType>
                                                 <xs:sequence>
              <xs:element name="Persons" type="Persons" minOccurs="0" maxOccurs="unbounded"/>
                                                 </xs:sequence>
                                            </xs:complexType>
                                       </xs:element>
                                  </xs:sequence>
                             </xs:complexType>
                        </xs:element>
                        <xs:element ref="ns1:ErrorMsgABCD"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    Person-response.xq:
    xquery version "1.0" encoding "Cp1252";
    (:: pragma parameter="$anyType1" type="xs:anyType" ::)
    (:: pragma bea:global-element-return element="ns0:processResponse" location="../XSD/ Person-response.xq" ::)
    declare namespace xf = "http://tempuri.org/oracle/xquery/Person-response/";
    declare namespace ns1 = "http://www.domain.com/XSD/ABCD";
    declare namespace ns0 = " http://www.domain.com/XSD/Persons";
    declare function xf:XQ_SEARCH_PERSONS_RESPONSE($anyType1 as element(*))
    as element(ns0:processResponse) {
    <ns0:processResponse>
    <ns0:bodyResponse>
         <ns0:PersonsCollection>
    <ns0:Persons>
    <ns0:id>{ data(0) }</ns0:id>
    <ns0:surname1>{ data(0) }</ns0:surname1>
    <ns0:surname2>{ data(0) }</ns0:surname2>
    <ns0:name>{ data(0) }</ns0:name>
    <ns0:code>{ data(0) }</ns0:code>
              </ns0:Persons>
         </ns0:PersonsCollection>
    </ns0:bodyResponse>
    </ns0:processResponse>
    declare variable $anyType1 as element(*) external;
    xf:XQ_SEARCH_PERSONS_RESPONSE ($anyType1)
    Edited by: chromosoma on Aug 30, 2012 12:47 PM
    Edited by: chromosoma on Aug 30, 2012 12:50 PM
    Edited by: chromosoma on Aug 30, 2012 1:00 PM

  • 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

  • How to add all namespaces in root node of xquery transformation result?

    Hi,
    I'm using xquery Transformation in oracle service bus to transfrom output. The schema used for output transfromation has elements being imported from several schemas. so that output xml has these long tags with namespaces of repective schemas e.g.
    <rr:Get360ViewOfProductResponse      xmlns:rr="http://canaldigital.com/schema/product/CPMProductInformation/v2.0/">
    <ResponseHeader>
    <com:ResponseCode xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" >0</com:ResponseCode>
    <com:ResponseText xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" >0</com:ResponseText>
    </ResponseHeader>
    </rr:Get360ViewOfProductResponse>
    what I want to achieve is that all namespaces come once in the rootNode and all childnodes just use the repective prefixes, so that the xml size doesnt grow too large.Like below.
    <rr:Get360ViewOfProductResponse      xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" xmlns:rr="http://canaldigital.com/schema/product/CPMProductInformation/v2.0/" xmlns:pr="http://broadcast.telenor.com/tsi/common/program_v1">
    <ResponseHeader>
    <com:ResponseCode>0</com:ResponseCode>
    <com:ResponseText>0</com:ResponseText>
    </ResponseHeader>
    </rr:Get360ViewOfProductResponse>
    the difference is that ResponseCode and responseText should only use their prefix, and not complete namespace. How can i acheive this.
    Thanks in advance.
    Edited by: 856401 on Feb 9, 2012 1:53 AM

    I get error 'Invalid expression- Unexpected token copy-namespaces'. Is it supported by xquery version 1.0 ? Following is the updated xquery transformation which gives static error:
    xquery version "1.0" encoding "Cp1252";
    (:: pragma bea:global-element-parameter parameter="$get360ViewOfProductResponse1" element="ns5:Get360ViewOfProductResponse" location="../XSD/CPMSchema_v20.xsd" ::)
    (:: pragma bea:global-element-return element="ns6:Get360ViewOfProductResponse" location="../XSD/CPMSchema_v3.xsd" ::)
    declare namespace ns2 = "http://broadcast.telenor.com/tsi/common/displayinformation_v1";
    declare namespace ns1 = "http://broadcast.telenor.com/tsi/common/commonparameters_v1";
    declare namespace ns4 = "http://broadcast.telenor.com/tsi/common/Property_v2";
    declare namespace ns3 = "http://broadcast.telenor.com/tsi/common/ProductMain_v2";
    declare namespace ns0 = "http://broadcast.telenor.com/tsi/common/condition_v1";
    declare namespace ns9 = "http://broadcast.telenor.com/tsi/common/extension_v1";
    declare namespace ns5 = "http://broadcast.telenor.com/tsi/psd/cpm/CPMSchema_v20";
    declare namespace ns6 = "http://canaldigital.com/schema/product/CPMProductInformation/v3.0/";
    declare namespace xf = "http://tempuri.org/CPM_OSB_v3/XQuery/Get360ViewOfProductResponse/";
    declare namespace ns7 = "http://broadcast.telenor.com/tsi/common/productofferingpricewithrules_v2";
    declare namespace ns8 = "http://broadcast.telenor.com/tsi/common/pricecomponent_v2";
    declare copy-namespaces preserve, inherit;
    declare function xf:Get360ViewOfProductResponse($get360ViewOfProductResponse1 as element(ns5:Get360ViewOfProductResponse))
    as element(ns6:Get360ViewOfProductResponse) {
    <ns6:Get360ViewOfProductResponse>
    <ResponseHeader>
    <ns1:ResponseCode>0</ns1:ResponseCode>
    <ns1:ResponseText>{ data($get360ViewOfProductResponse1/responseDescription) }</ns1:ResponseText>
    </ResponseHeader>
    </ns6:Get360ViewOfProductResponse>
    declare variable $get360ViewOfProductResponse1 as element(ns5:Get360ViewOfProductResponse) external;
    xf:Get360ViewOfProductResponse($get360ViewOfProductResponse1)

  • How to validate a date in xquery transformation

    i am doing the xquery transformation for mfl(non-xml) and xml
    i have a date-pickup and i should validate this field as my datatype is date , instead of date i am getting the data as 00000000 ,my date-pickup format is yyyymmdd
    can we do a validation for this specific field and all the failed date validations should be written as blank tag in xsd
    Please give me a suggestion for this

    Hi,
    There's a xquery extension function that you can use for that
    fn-bea:date-from-string-with-format
    The fn-bea:date-from-string-with-format() function returns a new date value from a string source value according to the specified pattern.
    The function has the following signature:
    fn-bea:date-from-string-with-format($format as xs:string?, $dateString as xs:string?) as xs:date?
    where $format is the pattern and $dateString is the date. For more information about specifying patterns, see Date and Time Patterns.
    Examples:
    fn-bea:date-from-string-with-format("yyyy-MM-dd G", "2005-06-22 AD") returns the specified date in the current time zone.
    fn-bea:date-from-string-with-format("yyyy-MM-dd", "2002-July-22") generates an error because the date string does not match the specified format.
    fn-bea:date-from-string-with-format(“yyyy-MMM-dd”, “2005-JUL-22”) returns the specified date in the current time zone.
    http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html#wp1297249
    Cheers,
    Vlad
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
    https://forums.oracle.com/forums/ann.jspa?annID=893

  • 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

  • How to include the first row of detail in every xquery transformed xml?

    I am dealing with a XML file,where i need to publish to different BS.
    First node will be a common node node which contains vital info,second node goes to one BS and third goes to another BS.
    *<header></header>*
    *<details></details> (they are unbounded, but the first detail tag which comes in the input file is a mandatory tag in such a way that it needs to be included in every transformed message)*
    *<trailer></trailer>*
    We need to apply x query transformation on it in such a way:
    *</header></header>*
    *<1st detail></1st detail>*
    *<detail></detail> (2nd row of detail in input file)* -------------------------> Goes to BS1
    *<trailer></trailer>..*
    *<header></header>*
    *<1st detail></1st detail>*
    *<detail></detail> (3rd row of detail in input file)* ----------------------------->Goes to BS2
    *<trailer></trailer>*..
    And so on.
    Now, the problem is how to include the first row( *1st detail* ) of detail in every xquery transformed xml?

    are you looping of this input with a for each?
    /yourdata/details[1] should return always the first detail element.
    or before the for each do an assing of this first detail element to "generic_details_var"
    and use this var in every looping iteration (in an assign or as input for xquery)

  • 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

  • [ALSB 3.0] help help about xquery transformation

    Hi all,
    I should transform a xml doc from
    <val_date>20081004</val_date>
    <par>
    <key>rpp</key>
    <value>10</value>
    </par>
    <par>
    <key>curry</key>
    <value>CHF</value>
    </par>
    to
    <val_date>20081004</val_date>
    <par>
    <key>rpp</key>
    <value>10</value>
    </par>
    <par>
    <key>curry</key>
    <value transcoder="CURRENCY">CHF</value>
    </par>
    I'm using WorkspaceStudio but I've some troubles in my xquery transformation.
    I tried as below:
    <ns1:val_date>{ data($dummyProviderEvent/ns0:val_date) }</ns1:val_date>
    for $par in $dummyProviderEvent/ns0:par
    return
    <ns1:par>
    <ns1:key>{ data($par/ns0:key) }</ns1:key>
    if ($par/ns0:key="curry") then <ns1:value transcoder="CURR">{ data($par/ns0:value) }</ns1:value>
    else <ns1:value>{ data($par/ns0:value) }</ns1:value>
    </ns1:par>
    </ns1:dummyEvent>
    but is not working:
    i) WorkspaceStudio raises a warning at 'else' line with message "XML element does not match the target schema"
    ii) testing the transformation it seems that if condition is always true
    Could you help me to find out the correct solution ?
    Regards
    ferp

    I know there were some changes to the packaging of the public API in 3.0. You may want to be sure you include all the necessary jar in your classpath. I think there is another post in the forum covering this.
    Gregory Haardt
    ALSB Prg. Manager
    [email protected]

  • XQuery Transformation in OSB for array of values

    Hi,
    I have followed the below tuts on the OSB tutorial.
    http://www.oracle.com/technetwork/articles/jumpstart-for-osb-development-page--097357.html
    Everything works fine. Except for the "GetAllCustomer" branch node.
    Step1 : Configured the BusinessService invoking the exposed WebService at localhost:7001 --> it works & returns proper values, testing through both SOAP Ui & OSB business service.
    Step 2 : Similarly configured the Proxy services with XQuery Transformation in place. --> it works with no error but not returning any values.
    Step 3 : after configuring XQuery Transformation tested it through OEPE --> returns result as expected.
    Please suggest where am going ??

    use a for loop or position for this..
    please check the below threads, for the same..
    Re: Assign activity erros with XPath query string returns multiple nodes.
    Re: OSB:for-each action working procedure with a sample.

  • Using XQuery Transformations

    Hi,
    I am new to OSB and have been trying my hand creating XQuery transformations.
    I have been getting the following error while testing the proxy service:
              (receiving request)
    Initial Message Context
    *          added $body*
    *     <soapenv:Body      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">*
    *     <ord:shipOrder      xmlns:ord="http://com/mycompany/order">*
    *     <ord:ord      xmlns:java="java:com.mycompany.order">*
    *     <java:City>string</java:City>*
    *     <java:FirstName>string</java:FirstName>*
    *     <java:LastName>string</java:LastName>*
    *     <java:OrderNumber>123</java:OrderNumber>*
    *     <java:PhoneNumber>string</java:PhoneNumber>*
    *     <java:PostalCode>string</java:PostalCode>*
    *     <java:ShippingType>ups</java:ShippingType>*
    *     <java:StateProvince>string</java:StateProvince>*
    *     <java:StreetAddress>string</java:StreetAddress>*
    *     <java:StreetAddress2>string</java:StreetAddress2>*
    *     </ord:ord>*
    *     </ord:shipOrder>*
    *     </soapenv:Body>*
    *          added $header*
    *     <soap:Header      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">*
    *     </soap:Header>*
    *          added $inbound*
    *     <con:endpoint      name="ProxyService$Shipping$proxy services$ShippingService_proxy" xmlns:con="http://www.bea.com/wli/sb/context">*
    *     <con:service>*
    *     <con:operation>shipOrder</con:operation>*
    *     </con:service>*
    *     <con:transport>*
    *     <con:uri>*
    *     /Shipping/proxy_services/ShippingService_proxy*
    *     </con:uri>*
    *     <con:mode>request-response</con:mode>*
    *     <con:qualityOfService>best-effort</con:qualityOfService>*
    *     <con:request      xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <http:Content-Type>text/xml; charset=utf-8</http:Content-Type>*
    *     <http:SOAPAction>""</http:SOAPAction>*
    *     </tran:headers>*
    *     <tran:encoding      xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>*
    *     </con:request>*
    *     <con:response      xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <http:Content-Type>text/xml</http:Content-Type>*
    *     </tran:headers>*
    *     <tran:response-code      xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>*
    *     </con:response>*
    *     </con:transport>*
    *     <con:security>*
    *     <con:transportClient>*
    *     <con:username>weblogic</con:username>*
    *     <con:principals>*
    *     <con:group>AdminChannelUsers</con:group>*
    *     <con:group>Administrators</con:group>*
    *     <con:group>IntegrationAdministrators</con:group>*
    *     </con:principals>*
    *     </con:transportClient>*
    *     </con:security>*
    *     </con:endpoint>*
    *          added $messageID*
    *2984534489141211043-6ec55042.129f907b433.-7fb0*
    *          RouteTo_ShippingTestService*
    Routed Service
    *          Route to: "ShippingTestService"*
    *     $outbound:*
    *     <con:endpoint      name="BusinessService$Shipping$business services$ShippingTestService" xmlns:con="http://www.bea.com/wli/sb/context">*
    *     <con:service>*
    *     <con:operation>shipOrder</con:operation>*
    *     </con:service>*
    *     <con:transport>*
    *     <con:mode>request-response</con:mode>*
    *     <con:qualityOfService>best-effort</con:qualityOfService>*
    *     <con:request      xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <http:Content-Type>text/xml</http:Content-Type>*
    *     <http:SOAPAction>""</http:SOAPAction>*
    *     </tran:headers>*
    *     </con:request>*
    *     </con:transport>*
    *     <con:security>*
    *     <con:doOutboundWss>false</con:doOutboundWss>*
    *     </con:security>*
    *     </con:endpoint>*
    *     $body (request):*
    *     <soapenv:Body      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">*
    *     <ser:shipOrder      xmlns:ser="http://com/mycompany/shipping/services">*
    *     <ser:upsOrder>*
    *     <java:Adr      xmlns:java="java:com.ups.model">*
    *     <java:AddressLine1>string</java:AddressLine1>*
    *     <java:AddressLine2>string</java:AddressLine2>*
    *     <java:City>string</java:City>*
    *     <java:PostalCode>string</java:PostalCode>*
    *     <java:StateProvince>string</java:StateProvince>*
    *     </java:Adr>*
    *     <java:FName      xmlns:java="java:com.ups.model">string</java:FName>*
    *     <java:LName      xmlns:java="java:com.ups.model">string</java:LName>*
    *     <java:OrderID      xmlns:java="java:com.ups.model">123</java:OrderID>*
    *     <java:PhoneNumber      xmlns:java="java:com.ups.model">string</java:PhoneNumber>*
    *     </ser:upsOrder>*
    *     </ser:shipOrder>*
    *     </soapenv:Body>*
    *     $header (request):*
    *     <soap:Header      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">*
    *     </soap:Header>*
    *     $attachments (request):*
    *     <con:attachments      xmlns:con="http://www.bea.com/wli/sb/context"/>*
    Message Context Changes
    *          added $outbound*
    *     <con:endpoint      name="BusinessService$Shipping$business services$ShippingTestService" xmlns:con="http://www.bea.com/wli/sb/context">*
    *     <con:service>*
    *     <con:operation>shipOrder</con:operation>*
    *     </con:service>*
    *     <con:transport>*
    *     <con:uri>*
    *     http://localhost:7051/ShippingServices/Order*
    *     </con:uri>*
    *     <con:mode>request-response</con:mode>*
    *     <con:qualityOfService>best-effort</con:qualityOfService>*
    *     <con:request      xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <http:Content-Type>text/xml; charset=utf-8</http:Content-Type>*
    *     <http:SOAPAction>""</http:SOAPAction>*
    *     </tran:headers>*
    *     <tran:encoding      xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>*
    *     </con:request>*
    *     <con:response      xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <tran:user-header      name="X-Powered-By" value="Servlet/2.5 JSP/2.1"/>*
    *     <http:Content-Type>text/xml; charset=utf-8</http:Content-Type>*
    *     <http:Date>Fri, 23 Jul 2010 09:05:25 GMT</http:Date>*
    *     <http:Transfer-Encoding>chunked</http:Transfer-Encoding>*
    *     </tran:headers>*
    *     <tran:response-code      xmlns:tran="http://www.bea.com/wli/sb/transports">2</tran:response-code>*
    *     <tran:response-message      xmlns:tran="http://www.bea.com/wli/sb/transports">Internal Server Error</tran:response-message>*
    *     <tran:encoding      xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>*
    *     <http:http-response-code>500</http:http-response-code>*
    *     </con:response>*
    *     </con:transport>*
    *     <con:security>*
    *     <con:doOutboundWss>false</con:doOutboundWss>*
    *     </con:security>*
    *     </con:endpoint>*
    *          added $transformMsg*
    *     <ser:shipOrder      xmlns:ser="http://com/mycompany/shipping/services">*
    *     <ser:upsOrder>*
    *     <java:Adr      xmlns:java="java:com.ups.model">*
    *     <java:AddressLine1>string</java:AddressLine1>*
    *     <java:AddressLine2>string</java:AddressLine2>*
    *     <java:City>string</java:City>*
    *     <java:PostalCode>string</java:PostalCode>*
    *     <java:StateProvince>string</java:StateProvince>*
    *     </java:Adr>*
    *     <java:FName      xmlns:java="java:com.ups.model">string</java:FName>*
    *     <java:LName      xmlns:java="java:com.ups.model">string</java:LName>*
    *     <java:OrderID      xmlns:java="java:com.ups.model">123</java:OrderID>*
    *     <java:PhoneNumber      xmlns:java="java:com.ups.model">string</java:PhoneNumber>*
    *     </ser:upsOrder>*
    *     </ser:shipOrder>*
    *          changed $body*
    *     <env:Body      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">*
    *     <SOAP-ENV:Fault      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">*
    *     <faultcode>SOAP-ENV:Client</faultcode>*
    *     <faultstring>*
    *     Failed to get operation name from incoming request*
    *     </faultstring>*
    *     </SOAP-ENV:Fault>*
    *     </env:Body>*
    *          changed $attachments*
    *     <con:attachments      xmlns:con="http://www.bea.com/wli/sb/context"/>*
    *          changed $inbound*
    *     <con:endpoint      name="ProxyService$Shipping$proxy services$ShippingService_proxy" xmlns:con="http://www.bea.com/wli/sb/context">*
    *     <con:service>*
    *     <con:operation>shipOrder</con:operation>*
    *     </con:service>*
    *     <con:transport>*
    *     <con:uri>*
    *     /Shipping/proxy_services/ShippingService_proxy*
    *     </con:uri>*
    *     <con:mode>request-response</con:mode>*
    *     <con:qualityOfService>best-effort</con:qualityOfService>*
    *     <con:request      xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <http:Content-Type>text/xml; charset=utf-8</http:Content-Type>*
    *     <http:SOAPAction>""</http:SOAPAction>*
    *     </tran:headers>*
    *     <tran:encoding      xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>*
    *     </con:request>*
    *     <con:response      xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">*
    *     <tran:headers      xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">*
    *     <http:Content-Type>text/xml</http:Content-Type>*
    *     </tran:headers>*
    *     <tran:response-code      xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>*
    *     </con:response>*
    *     </con:transport>*
    *     <con:security>*
    *     <con:transportClient>*
    *     <con:username>weblogic</con:username>*
    *     <con:principals>*
    *     <con:group>AdminChannelUsers</con:group>*
    *     <con:group>Administrators</con:group>*
    *     <con:group>IntegrationAdministrators</con:group>*
    *     </con:principals>*
    *     </con:transportClient>*
    *     </con:security>*
    *     </con:endpoint>*
    *          changed $header*
    *     <env:Header      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"/>*
    *          System Error Handler*
    *$fault:      *
    *     <con:fault      xmlns:con="http://www.bea.com/wli/sb/context">*
    *     <con:errorCode>BEA-380001</con:errorCode>*
    *     <con:reason>Internal Server Error</con:reason>*
    *     <con:location>*
    *     <con:node>RouteTo_ShippingTestService</con:node>*
    *     <con:path>response-pipeline</con:path>*
    *     </con:location>*
    *     </con:fault>*
    Any pointers on why this error is occuring and what needs to be done to resolve it.
    Thanks
    Priya.

    Hi Eric,
    Sorry for the delay in responding.
    I tested just the XQuery with the payload I used in the example. It works perfectly fine. No errors or warnings were raised.
    Regards
    Priya.

  • 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

  • Problems in SQL transform with variable in statement

    Hi,
    I have an sql transform with a variable in the statement. It looks like this:
    SELECT * FROM I.X where I.X.CUSTOMERNUMBER IN ([$variable])
    I have a script running prior which sets the $variable = '\'366800\',\'000933\'';
    (the CUSTOMERNUMBER field is a string)
    The problem is when DI compiles the SQL with the variable value, it is replacing each single quote with two single quotes, and thus turning my list of values into a single string (as recognised by DB2).
    How can I work around this? The CUSTOMERNUMBER field is indexed and the table is very large, so I want to use a very efficient statement to retrieve the data. I'm inserting this data into a different database, so I can't use the sql() function to execute the query and insert the rows into a new table in the same database (don't have authority to do that).
    I also need the sql to be dynamic because the customer numbers required will change from time to time. They're listed in another database and I plan on writing a loop to set the $variable value to contain all values in the lookup table, but I can't use that in a join because its in a different database and would not be efficient.
    Does anyone have any ideas? I'm literally all out, have tried a wide range of things to no avail, and none of my colleagues can work it out either.
    Thanks very much,
    -Steve

    I assume the SQL Transform is used only because of that in-list, not for other reasons....
    In this book page here: https://boc.sdn.sap.com/node/20046 at the very bottom it isdescribed on how to use the pushdown_sql() function in a where clause to add *any* text of your choice into the select statement DI generates. In this example I used a "where exists" but you can easily change the text to
    where key=5 and       pushdown_sql('my_datastore', 'CUSTOMERNUMBER IN ([$variable])')    and gender='M'
    I used the key=5 and gender=M just to clarify the syntax (I hope).
    For the SQL Transform, I wonder if you need the [$variable] syntax as well....

  • Not able to find a simple type in Xquery transformation

    Hi,
    In Eclipse, for Xquery transformation, i am not able to find the XMLObject simple type, under the source or target mapping simple type.
    Need help plzz
    Thanks,
    Sarat

    XMLObject is not a XML Schema data type, it is a Java data type. So you wont see it in XQuery graphical mapper. XMLObject in Java is mapped to xs:anyType in Schema. What is your exact requirement?

Maybe you are looking for

  • Reg:Graphical view in workflow

    Hi to all, Now i am having IDES ECC 6.0 , I had put the TC SWDD i am getting workflow screen. But i couldnt find out the graphical view of that screen.But the graphical view and all i can get through ECC 5.0 version. Kinldy do the helpful. Thanks, Sa

  • Product Allocation--Can we Have in MC94 Planning for 2 or 3 materials

    Hi,Experts , As MC94 shows only one column for every Months allocation ,example 07.2009,08.2009......... then---> 1>can we have 2 or 3 materials and 2 or 3 customers for same Production allocation Procedures like can we have 0000000000001-Product All

  • How to Create LOVs in ADF  pragmatically  if DataControl is from WebService

    Hi All, I consumed Web-services in ADF application to do CRUD operation on some tables(for example i created one web service which perform all crud operations on database that tables are mapped) now what i required is i consumed that web services, I

  • Virtual 3DS on ESXi

    We're trying to get a new Sourcefire solution up and running.  We're using the virtual servers rather than physical installed onto an ESXi 5.1 host. We're running the 3DS in passive mode so we have 3 network adapters configured, 1 for management, 1 f

  • I have sound either with my desktop speakers OR my HDTV connected with an HDMI cable

    I have a Media center desktop - Model M7330n, product number ERR101AA-ABA. It has onRealtek AC97 audio on-board audio (I think) I just upgraded to a GeForce 210 graphics card in order to be able to connect to my flat screen using an HDMI cable. I am