Xquery transformation and namespaces

I'm transforming one XML document based on schema A to another XML document based on schema B. Thransformation works ok, except for the problem with namespaces. My result document looks like this:
<ns0:root xmlns:ns0="namespaceA">
     <ns0:request>
          <ns1:Element xmlns:ns1="namespaceB">value1</ns1:Element>
          <ns1:Attribute xmlns:ns1="namespaceB">value2</ns1:Attribute>
          <ns1:Attribute xmlns:ns1="namespaceB">value3</ns1:Attribute>
          <ns1:Attribute xmlns:ns1="namespaceB">value4</ns1:Attribute>
     </ns0:request>
</ns0:root>
The problem is that namespace attribute is repeated in each element. I want to declare namespaceB in root and than use only prefixes. So document should loook like this:
<ns0:root xmlns:ns0="namespaceA" xmlns:ns1="namespaceB">
     <ns0:request>
          <ns1:Element>value1</ns1:Element>
          <ns1:Attribute>value2</ns1:Attribute>
          <ns1:Attribute>value3</ns1:Attribute>
          <ns1:Attribute>value4</ns1:Attribute>
     </ns0:request>
</ns0:root>
Is it possible to achieve that, and how?
Thanks for help.

Helo!
I saw yesterday this soluction:
It's best not to think of this as "removing the namespaces" but rather as
"changing the element names". The name of an element consists of a namespace
URI and a local name. So the name of the Email element, for example, is
("urn:mpeg:mpeg7:schema:2001", "email"). In your desired result, you want an
Email element without the namespace, that is, you want the name of the
element in the result to be ("", "email"). So your query has to rename every
element, or to put it another way, it has to create an element whose name is
different from the original.
The way to do this is to write a recursive function something like this:
declare function f:strip-namespace($e as element()) as element() {
element {QName((), local-name($e)} {
for $child in $e/(@*,*)
return
if ($child instance of element())
then f:strip-namespace($child)
else $child
AUTHOR: Michael Kay
see at:
http://www.x-query.com/pipermail/talk/2006-January/001062.html

Similar Messages

  • 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)

  • OSB XQuery transformation help in Proxy Service

    Hi,
    Need help in transformation of the below input to a proxy service
    <soapenv:Body  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <InputParams>
         <queryParams>
           <quer:query-params  xmlns:quer="http://www.example.org/QueryParams">
            <param name="test51" value="val3353" />
            <param name="test1" value="val2" />
            <param name="test3" value="val3" />
            <param name="test4" value="val4" />
            <param name="test1" value="val1" />
            <param name="test1" value="val11" />
            <param name="test8" value="val33" />
            <param name="test1" value="val34" />
            <param name="test8" value="val33" />
            <param name="test81" value="val33" />
            <param name="test1" value="val333" />
            <param name="test38" value="val33" />
           </quer:query-params>
         </queryParams>
       </InputParams>
    </soapenv:Body> and want to have the below output after running the below XQuery transformation
    <ns0:mparams>
      <ns0:param name="test1" value="val2" />
      <ns0:param name="test1" value="val1" />
      <ns0:param name="test1" value="val11" />
      <ns0:param name="test1" value="val34" />
      <ns0:param name="test1" value="val333" />
    </ns0:mparams>this is the xquery transformation file
    (:: pragma  parameter="$InputQuery" type="anyType" ::)
    (:: pragma bea:global-element-return element="ns0:mparams" location="../xsd/TargetParams.xsd" ::)
    declare namespace ns0 = "http://www.example.org/QueryParams";
    declare namespace xf = "http://tempuri.org/Simple/transformation/listparams/";
    declare function xf:listparams($InputQuery as element(*))
        as element(ns0:mparams) {
            <ns0:mparams>
                { $InputQuery/ns0:params/param[@name="test1"] }
            </ns0:mparams>
    declare variable $InputQuery as element(*) external;
    xf:listparams($InputQuery)and here is the input to the above .qs
    $body/InputParams/queryParams/qp:query-paramsbut it's the output is always empty and here is what it comes out no matter what the input I give even tried the below inputs but no use
    $body/InputParams/queryParams/qp:query-params
    $body/InputParams/queryParamshere is the output it always prints when logging in the log file
    <quer:mparams xmlns:quer="http://www.example.org/QueryParams"/>Any help is appreciated.
    Thanks

    $InputQuery/ns0:params/param[@name="test1"]Input doesn't have a ns0:params node ..so the xpath here should be $InputQuery/param[@name="test1"]

  • 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

  • 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

  • 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

  • XQuery transformation in OSB

    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
    Mani

    http://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

  • Help on XQuery transformation

    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

  • 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 XML node to string using Xquery transformation in OSB

    How to convert XML node to string using a built in function using Xquery transformation in OSB? In BPEL we have the Xpath extension function ora:getContentAsString() to do the same.

    fn:bea-serialize() function converts xml node to string. but it assigns namespace prefix in every xml node during the conversion. So is there any function to remove the namespace prefix from XML node using Xquery built in function?

  • How to execute a xquery transformation loaded dynamically

    Hi all,
    I wrote a simple java class that exposes a method for returning a xml string containing a XQuery transformation, let's say myXQ.
    Then I used a java callout action in order to execute this java class and store the result (that is myXQ) into a variable called myTransf.
    Now I would like to ask ALSB to execute this myTransf and I'm looking a way, through an assign action (or in another way), to specify to use myTransf as a XQuery resource.
    Is this possible ? Do you know a way to do what I'm looking for ?
    Regards
    Patrizio

    Hi,
    this should work :SQL> declare
      2  l_sql varchar2(100);
      3  l_result varchar2(30);
      4  begin
      5  dbms_output.put_line('before exec : '||l_result);
      6  l_sql := 'select to_char(sysdate,''yyyymmdd'') from dual' ;
      7  execute immediate l_sql into l_result ;
      8  dbms_output.put_line('after exec : '||l_result);
      9  end;
    10  /
    before exec :
    after exec : 20100917

  • EXTREMELY SLOW XQUERY PERFORMANCE AND SLOW DOCUMENT INSERTS

    EXTREMELY SLOW XQUERY PERFORMANCE AND SLOW DOCUMENT INSERTS.
    Resolution History
    12-JUN-07 15:01:17 GMT
    ### Complete Problem Description ###
    A test file is being used to do inserts into a schemaless XML DB. The file is inserted and then links are made to 4
    different collection folders under /public. The inserts are pretty slow (about
    15 per second and the file is small)but the xquery doesn't even complete when
    there are 500 documents to query against.
    The same xquery has been tested on a competitors system and it has lightening fast performance there. I know it
    should likewise be fast on Oracle, but I haven't been able to figure out what
    is going on except that I suspect somehow a cartesian product is the result of
    the query on Oracle.
    ### SQLXML, XQUERY, PL/SQL syntax used ###
    Here is the key plsql code that calls the DBMS_XDB procedures:
    CREATE OR REPLACE TYPE "XDB"."RESOURCEARRAY" AS VARRAY(500) OF VARCHAR2(256);
    PROCEDURE AddOrReplaceResource(
    resourceUri VARCHAR2,
    resourceContents SYS.XMLTYPE,
    public_collections in ResourceArray
    ) AS
    b BOOLEAN;
    privateResourceUri path_view.path%TYPE;
    resource_exists EXCEPTION;
    pragma exception_init(resource_exists,-31003);
    BEGIN
    /* Store the document in private folder */
    privateResourceUri := GetPrivateResourceUri(resourceUri);
    BEGIN
    b := dbms_xdb.createResource(privateResourceUri, resourceContents);
    EXCEPTION
    WHEN resource_exists THEN
    DELETE FROM resource_view WHERE equals_path(res, privateResourceUri)=1;
    b := dbms_xdb.createResource(privateResourceUri, resourceContents);
    END;
    /* add a link in /public/<collection-name> for each collection passed in */
    FOR i IN 1 .. public_collections.count LOOP
    BEGIN
    dbms_xdb.link(privateResourceUri,public_collections(i),resourceUri);
    EXCEPTION
    WHEN resource_exists THEN
    dbms_xdb.deleteResource(concat(concat(public_collections(i),'/'),resourceUri));
    dbms_xdb.link(privateResourceUri,public_collections(i),resourceUri);
    END;
    END LOOP;
    COMMIT;
    END;
    FUNCTION GetPrivateResourceUri(
    resourceUri VARCHAR2
    ) RETURN VARCHAR2 AS
    BEGIN
    return concat('/ems/docs/',REGEXP_SUBSTR(resourceUri,'[a-zA-z0-9.-]*$'));
    END;
    ### Info for XML Querying ###
    Here is the XQuery and a sample of the output follows:
    declare namespace c2ns="urn:xmlns:NCC-C2IEDM";
    for $cotEvent in collection("/public")/event
    return
    <cotEntity>
    {$cotEvent}
    {for $d in collection("/public")/c2ns:OpContextMembership[c2ns:Entity/c2ns:EntityIdentifier
    /c2ns:EntityId=xs:string($cotEvent/@uid)]
    return
    $d
    </cotEntity>
    Sample output:
    <cotEntity><event how="m-r" opex="o-" version="2" uid="XXX541113454" type="a-h-G-" stale="2007-03-05T15:36:26.000Z"
    start="2007-03-
    05T15:36:26.000Z" time="2007-03-05T15:36:26.000Z"><point ce="" le="" lat="5.19098483230079" lon="-5.333597827082126"
    hae="0.0"/><de
    tail><track course="26.0" speed="9.26"/></detail></event></cotEntity>

    19-JUN-07 04:34:27 GMT
    UPDATE
    =======
    Hi Arnold,
    you wrote -
    Please use Sun JDK 1.5 java to perform the test case.Right now I have -
    $ which java
    /usr/bin/java
    $ java -version
    java version "1.4.2"
    gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
    sorry as I told you before I am not very knowledgeable in Java. Can you tell me what setting
    s I need to change to make use of Sun JDK 1.5. Please note I am testing on Linux
    . Do I need to test this on a SUN box? Can it not be modify to run on Linux?
    Thanks,
    Rakesh
    STATUS
    =======
    @CUS -- Waiting for requested information

Maybe you are looking for