OSB - help in XQuery
Hi,
I am having a replace in proxy service to transform AIA format to custom format.
I have a XQuery file for this.
In Replace :
XPath - .
In variable - body
Expression - browsed the xquery resource
- in bind variables:
variable name - createssalesorder1
binding - $body (what should I give for binding??)
Replace node contents
The XQuery file is :
(:: pragma bea:global-element-parameter parameter="$createSalesOrder1" element="ns5:CreateSalesOrder" location="../../aia_11_1/AIAComponents/EnterpriseObjectLibrary/Core/EBO/SalesOrder/V2/SalesOrderEBM.xsd" ::)
(:: pragma bea:global-element-return element="ns1:order" location="../schemas/ean.ucc/order/Order.xsd" ::)
declare namespace ns2 = "http://xmlns.oracle.com/EnterpriseObjects/Core/Custom/EBO/SalesOrder/V2";
declare namespace ns1 = "urn:ean.ucc:order:2";
declare namespace ns4 = "http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2";
declare namespace ns3 = "http://xmlns.oracle.com/EnterpriseObjects/Core/Custom/Common/V2";
declare namespace ns0 = "urn:ean.ucc:2";
declare namespace ns5 = "http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/SalesOrder/V2";
declare namespace xf = "http://tempuri.org/df.om_1.0/transforms/AIASalesOrder2GS1OrderProxy/";
declare function xf:AIASalesOrder2GS1OrderProxy($createSalesOrder1 as element(ns5:CreateSalesOrder))
as element(ns1:order) {
<ns1:order>
<orderIdentification>
<uniqueCreatorIdentification>{ fn:string($createSalesOrder1/ns4:Identification/ns4:ID/@schemeID) }</uniqueCreatorIdentification>
<contentOwner>
<additionalPartyIdentification>
<additionalPartyIdentificationType>BUYER_ASSIGNED_IDENTIFIER_FOR_A_PARTY</additionalPartyIdentificationType>
</additionalPartyIdentification>
</contentOwner>
</orderIdentification>
<orderPartyInformation>
<seller>
<additionalPartyIdentification>
<additionalPartyIdentificationType>SUPPLIER_ASSIGNED_IDENTIFIER_FOR_A_PARTY</additionalPartyIdentificationType>
</additionalPartyIdentification>
</seller>
</orderPartyInformation>
</ns1:order>
declare variable $createSalesOrder1 as element(ns5:CreateSalesOrder) external;
xf:AIASalesOrder2GS1OrderProxy($createSalesOrder1)
When I test the proxy service using console, I get
BEA-382513: OSB Replace action failed updating variable "body": 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://xmlns.oracle.com/EnterpriseObjects/Core/EBO/SalesOrder/V2}CreateSalesOrder { {http://www.w3.org/2001/XMLSchema}anyType }
I am new to XQuery and any help on where am I going wrong on this?
Also is there an example/tutorial for the above scenario?
Thanks
Ganesh
Hello Ganesh,
Try with "$body/*" in the binding.
If it does not work then please paste the input xml of the proxy here. Actualiy, your proxy's input xml must be having an element of type "ns5:CreateSalesOrder" and you have to give that element's X-path in Xquery binding.
Regards,
Anuj
Similar Messages
-
Accessing OSB variables in XQuery Transformation
Hi All,
I have a requirement to access OSB variable in XQuery context.
Anybody has any idea on how to get this?
Thanks,
Praveenthe xquery doesn't know anything on runtime about the variables like $body, $header, etc
so like Prabu said, you will need to pass all that data to your xquery as parameter to be able to query them -
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. -
I need an urgent help for Xquery tranformation failed on OSB.
I have made an xq then imported it into my proxyService, but when I call my proxyService I get the following error.
here is the response of my proxyService call.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>BEA-382513: ALSB Replace action failed updating variable "body": 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://skat.dk/begrebsmodel/2009/01/15/}EFIBetalingOrdningMisligholdt_I { {http://www.w3.org/2001/XMLSchema}anyType }</faultstring>
<detail>
<con:fault xmlns:con="http://www.bea.com/wli/sb/context">
<con:errorCode>BEA-382513</con:errorCode>
<con:reason>ALSB Replace action failed updating variable "body": 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://skat.dk/begrebsmodel/2009/01/15/}EFIBetalingOrdningMisligholdt_I { {http://www.w3.org/2001/XMLSchema}anyType }</con:reason>
<con:location>
<con:node>RouteNode1</con:node>
<con:path>request-pipeline</con:path>
</con:location>
</con:fault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>are you replacing the body-tag instead the first child of the body, in your case EFIBetalingOrdningMisligholdt_I
first do a test like
in your xquery return something like
<EFIBetalingOrdningMisligholdt_I></EFIBetalingOrdningMisligholdt_I>
in your proxy service do something like
replace ./* in body with ....your xquery call result
and see if this works
i think your replacing content at the wrong 'level' -
[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
ferpI 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] -
Hello Friends,
I am trying to do a XQuery transformation which does not like straight one to one. I am not an expert so I don't know what I am trying to achieve is capable or not.
So please Guys me ...
My Source Element are like :
<Node1>
<Node2>
<Node3>
<Node4>
<Node5>
<Node6>
My Destination elements are :
<Dest1>
<Dest2>
<Dest3>
<Dest4>
Now in transformation I need put some logic like this :
1. check if node1 and node 2 has some data then copy node1 + node 2 data in Data1 othwise if node 2 present then copy only node 2 data.
2. similary if node 1 and node 2 node are not present then copy node 3 (if present) in dest 1 and node 4 data in dest2 subsequently.
So, like this different combination of source nodes data will map to 4 destination nodes.
I am trying my hands but no success yet.
So please help me.If it is possible then can anyone write a simple example for this.
Thanking in Anticipation.For the conditional part check http://www.w3schools.com/xquery/xquery_syntax.asp
and to combine the nodes check http://www.xqueryfunctions.com/xq/fn_concat.html
hth,
Peter Paul -
OSB 11G xsl/xquery question in Proxy
OSB 11G
In Proxy, I have to invoke a business service which has 3 operations
I need to use response of first 2 operations,as request to third operation along with some input xml to OSB Proxy.
customer, group, severity are hard coded.(which will be input to OSB)
How do I add/insert response from op1 after <string>customer</string> ??
and response from op2 after <string>group</string> . ??
<InvokecreateRequest_InputVariable>
<part name="parameters" >
<createRequest>
<sid>1959439747</sid> // is resp from operation1, which is request to operations3
<creatorHandle/>
*<attrVals>* // this is array of string
<string>customer</string>
<string>cnt:08DF89FC07516A41B228587DBE75B6A7</string> //resp from op1, that has to be request to op3
<string>group</string>
<string>B79AAF63D870F845980A</string> //input to OSB
<string>severity</string>
<string>2</string> //input to OSB
*</attrVals>*
<propertyValues>
<string/>
</propertyValues>
<template/>
<attributes>
<string>persistent_id</string>
</attributes>
</createRequest>
</part>
</InvokecreateRequest_InputVariable>
Also, should I use assign or insert in Proxy ??Not sure exactly what you need, but here is a basic layout of what you need to do.
Make a service callout to the first operation and save the response in a variable, for ex $resOne
Then make a service callout to the second operation ans save the response in a variable for ex $resTwo.
Now use a replace or assign action to create the request for the third operation:
If you are using a Route action on Route node to call the third operation, you should use a replace action and replace the contents of $body with the XML content as needed. If you are going to use another service callout, then you should use an assign to create a request variable.
In either case, this is what your XQuery should look like:
<InvokecreateRequest_InputVariable>
<part name="parameters" >
<createRequest>
<sid>{$resOne/ns:ElementName/ns:SID/text()}</sid> // Here you will populate value from $resOne using a correct XPath
<creatorHandle/>
<attrVals>
<string>customer</string>
<string>cnt:08DF89FC07516A41B228587DBE75B6A7</string>
{$resOne} // here you are inserting the complete response from Operation one
<string>group</string>
{{$resTwo} // here you are inserting the complete response from Operation Two, You can choose to populate these values separately inside variables like for SID above.
<string>B79AAF63D870F845980A</string>
<string>severity</string>
<string>2</string> //input to OSB
</attrVals>
<propertyValues>
<string/>
</propertyValues>
<template/>
<attributes>
<string>persistent_id</string>
</attributes>
</createRequest>
</part>
</InvokecreateRequest_InputVariable> -
Hi guys,
how to add years to a date in osb.
as my tranformation needs target node as cobination of year+date, i tried with xquery functions avaailable in osb, but didnt find any function which adds year to a date.
Thanks in advance.
regards,
shaik.
Edited by: shaik.apps on Feb 25, 2010 8:58 PMI don't know of any such a function in OSB. If I needed that now, I would probably have to split date into its components, add to year (as a number) and then again compose new date from components. Maybe something like this:
xquery version "1.0" encoding "UTF-8";
declare namespace xf = "http://com.mycompany/xquery/add-year";
declare function xf:pad($input as xs:integer)
as xs:string {
if ($input < 10)
then
fn:concat('0', $input)
else
xs:string($input)
declare function xf:add-to-year($date as xs:date, $years as xs:integer)
as xs:date {
xs:date(fn:concat(fn:year-from-date($date)+$years, '-', xf:pad(fn:month-from-date($date)), '-', xf:pad(fn:day-from-date($date))))
xf:add-to-year(fn:current-date(), 3)What an ugly thing! :-) Hope somebody around knows something better ... -
I have 2 xml documents Team and Player
Here is how they look like
team.xml
<Teams>
<Team>
<Lost>59</Lost>
<Name>NewYork</Name>
<Won>103</Won>
</Team>
<Team>
</Team>
<Teams>
player.xml
<Players>
<Player>
<Age>24</Age>
<Team>NewYork</Team>
<BOB>67</BOB>
<SOT>265</SOT>
<IPT>229.3</IPT>
</Player>
<Player>
</Player>
<Players>I want to write a xquery to dsiplay for each team; the number of good* players, the avg age of good players, the number of total players and avg age of total players.
The criteria for a good player is (BOB + SOT) / IPT < 0.91.
This what I tried
for $x in distinct-values (doc("team.xml")/Teams/Team/Team)
let $y:= doc("player.xml")/Players/Player[Team=$x]
return
<Team>
<Team_Name>{data($x)}</Team_Name>
<Total_players>{count($y)}</Total_players>
<Average_Age>{avg($y/Age)}</Average_Age>
</Team>Using this I get the the number of total players and avg age of total players. However, i'm not sure how I can modify this to return the information about good players as well.
Can someone please help me with this.
Thanks.Try something like this
xquery version "1.0";
<Table>
for $x in distinct-values (doc("team.xml")/Teams/Team/Name)
let $y:= doc("player.xml")/Players/Player[Team=$x]
let $z:= $y[(BOB + SOT) div IPT < 0.91]
return
<Team>
<Team_Name>{data($x)}</Team_Name>
<Total_players>{count($y)}</Total_players>
<Good_players>{count($z)}</Good_players>
<Average_Age>{avg($y/Age)}</Average_Age>
{for $p in $y
return
<PlayerRating>
{$p/Age}
<GoodPlayer>{$p/BOB + $p/SOT div $p/IPT lt 0.91}
</GoodPlayer>
<PlayerScore>
{$p/BOB + $p/SOT div $p/IPT}
</PlayerScore>
</PlayerRating>
</Team>
</Table>HTH,
chris
Edited by: chrisis on Nov 28, 2009 1:59 PM -
I'm having a problem understanding the results of a Return in a FLWOR. Basically I want the second part of the XQuery to operate on the total return of the first part.
I have a series of documents in one collection. Each document at the top level has the tag <flight-data> which has an aircraft ID as an attribute. Then within the document, there is lower level data under the tag <maintenance-raw-data> that contains fault IDs.
An example of two of the documents in the collection:
<flight-data aircraft-id = “1”>
<maintenance-raw-data fault-id=“0001”>
<maintenance-raw-data fault-id=“0002”>
<maintenance-raw-data fault-id=“0003”>
<maintenance-raw-data fault-id=“0001”>
</flight-data>
<flight-data aircraft-id = “2”>
<maintenance-raw-data fault-id=“0002”>
<maintenance-raw-data fault-id=“0003”>
<maintenance-raw-data fault-id=“0003”>
<maintenance-raw-data fault-id=“0004”>
<maintenance-raw-data fault-id=“0005”>
</flight-data>
So the intent of the xquery was to select all the data for one or more aircraft, then on that “total” selection, get a distinct list of all fault IDs. The xquery is as follows:
for $z in collection("brickdata2")/flight-data
where $z/@aircraft-id="1" or $z/@aircraft-id="2") return
for $x in distinct-values($z//maintenance-raw-data/@fault-id) return $x
Basically, I want the query to return the flight-data for both aircraft and then, on that total return, find the unique fault IDs. However, the second part operates on the unique fault IDs for each aircraft separately. It gives the unique fault IDs for the first aircraft and then the unique fault IDs for the second aircraft.
Query results with Aircraft 1 and Aircraft 2 in Where clause
Fault ID 0001
Fault ID 0002
Fault ID 0003
Fault ID 0002
Fault ID 0003
Fault ID 0004
Fault ID 0005
So we then changed the first line of the XQuery to “let $z := collection”. etc.” and then the query retrieving both aircraft works (you get 0001, 0002, 0003, 0004, 0005) “ but if you change the where clause to retrieve for only one aircraft (either one), you get the same answer (i.e., fault IDs for both aircraft).
Appreciate any help. Thanks in advance.Basically, I want the query to return the flight-data for both aircraft and then, on that total return, find the unique fault IDs. However, the second part operates on the unique fault IDs for each aircraft separately. It gives the unique fault IDs for the first aircraft and then the unique fault IDs for the second aircraft.You can do it like the following, by first retrieving the whole sequence of attributes for both aircrafts, then applying distinct-values() :
distinct-values(
for $z in collection("brickdata2")/flight-data
where $z/@aircraft-id = "1"
or $z/@aircraft-id = "2"
return $z/maintenance-raw-data/@fault-id
) -
Need help with Xquery Syntax.
Hi there,
I am using a Berkeley XML DB and I have a xquery which I need to execute in a particular format. I have the following xquery:
for $a in collection("test.dbxml")/Bookstore/Book where $a/book_ID/text() eq "6" return $a/book_ID/text()
This xquery runs fine and I have the end result to be 6.
I need the same result to be specified in a XML TAG like <order_ID> 6 </order_ID> for which I have the following xquery:
for $a in collection"test.dbxml")/Bookstore/Book where $a/book_ID/text() eq "6" return <order_ID>$a/book_ID/text()</order_ID>
This xquery runs but return me back with the string "<order_ID>$a/book_ID/text()</order_ID>".
Can you please help me to correct the above output to result in "<order_ID> 6 </order_ID>"
Thanks.Try
for $a in collection("test.dbxml")/Bookstore/Book
where $a/book_ID/text() eq "6"
return <order_ID>{$a/book_ID/text()}</order_ID>Lauren Foutz
Edited by: LaurenFoutz on Apr 17, 2009 9:41 AM -
Hi,
Due to a bug I cannot use the OSB web interface so trying to do everything through cmd. Problem is all documentation and OBE is using the front end therefore does anyone have any pointers for getting started with OSB by using the cmd.
I have managed to configure a host, tape device and schedule a backup of the file system, the job completes successfully but then i cannot find the backup itself, probably a user error.
Any help on the basics would be appreciated, either a database backup or file system backup.
Regards
SebHi
i created a dataset and submitted a backup job, however once completed i couldn't find the backup or restore it, again probably a user error but any pointers would be good. Also when i submit jobs it sometimes says that it cannot find the group id?
ob> lsjob --long admin/1
admin/1:
Type: dataset mydataset1/test.ds
Level: full
Family: (null)
Scheduled time: none
State: completed successfully at 2007/11/09.13:48
Priority: 100
Privileged op: no
Run on host: (administrative server)
Attempts: 1
ob> -
I have a table as below ; and i get to a record in the table using the primary key
create table raees_test
unique_rec_id varchar2(16) not null primary key ,
racn_nbr number(5),
blob_value blob,
invoice_data SYS.XMLTYPE
I want to query the xml type column using Xquery where I want to reach to it through the unique_rec_id
please let me know how to implement the query
Thanks
RaeesBasically, I want the query to return the flight-data for both aircraft and then, on that total return, find the unique fault IDs. However, the second part operates on the unique fault IDs for each aircraft separately. It gives the unique fault IDs for the first aircraft and then the unique fault IDs for the second aircraft.You can do it like the following, by first retrieving the whole sequence of attributes for both aircrafts, then applying distinct-values() :
distinct-values(
for $z in collection("brickdata2")/flight-data
where $z/@aircraft-id = "1"
or $z/@aircraft-id = "2"
return $z/maintenance-raw-data/@fault-id
) -
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() -
Hi
can any body tell how to make xquery transformation for the requirement like source as xml and target as schema,please provide related links if any
Thanks
Manihttp://docs.oracle.com/cd/E13160_01/wli/docs10gr3/dtguide/
http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/userguide/xquery.html
Already a thread is available.
sample examples for doing XQuery transformation within OSB
Hope this helps.
Thanks,
Vijay
Maybe you are looking for
-
How is it possible for Adobe Support to be so bad ?
I mean really ! For a multi billion dollar company, support is worse than Microsoft ! And that speaks heaps ! I had the worst customer experience throughout the day with people that have no grasp over the english language and moreso, no technical ski
-
when i start itune than error shows this ipod cannot be use because the required software not install
-
Agilent 34980A simulation using IVI-drivers in Teststand?
Hello! I am unable to simulate 34980A in TestStand and here are some results based on testing: Agilent 34980A is linked to logical name SampleDmm. Simulate With: Specific Driver. IviStepTypes.seq used with only DMM and Switch steps. Using IviDMM IVI-
-
Null reference exception using Microsoft.Unity on DisposeOfChildContainer()
I am working on mvc application which also has webapi. Application is throwing System.NullReference Exception in production. (MVC 5, WebApi 2.0, .Net 4.5, Unity 3.0) Error message System.NullReferenceException: Object reference not set to an instance
-
"Your Set-Top Box details could not be retrieved" on my TV service page
I just had TV service added yesterday. The DVR works. But when I go to My Services page on Verizon web site (http://www22.verizon.com/ForYourHome/MyAccount/Protected/Services/MyServices.aspx) it shows the box but not activated. After some help from l