How to use typeswitch in osb xquery ?

Hi all,
I couldnt understand the syntax of the x query type switch used in osb.Can anybody kindly explain it or give links to examples.
typeswitch (())
case $case-var as element(*) return ()
default ()
1) what should be given inside the typeswitch (()) ?
2) what should be given as this variable $case-var ?
3) what is the meaning of sequence type element(*) ?
4) Is the typeswitch in x query used to avoid multiple nested if or is it something else ?
Thank you.
Edited by: Arun Vikram on Jul 18, 2010 11:47 PM
Edited by: Arun Vikram on Jul 19, 2010 12:00 AM

Hi Arun,
See the section "2.11 Operations on Datatypes" of below doc -
http://www.w3.org/TR/2001/WD-xquery-20010607/
typeswitch is explained with an example in this section. typeswitch is similar concept as "switch" in Java.
1) what should be given inside the typeswitch (()) ?The expression whose dynamic type is being tested.
2) what should be given as this variable $case-var ?Each CASE clause specifies the name of a type, which must be a subtype of the static type of the operand expression, followed by a RETURN expression.
3) what is the meaning of sequence type element(*) ?Any XML node
4) Is the typeswitch in x query used to avoid multiple nested if or is it something else ?As said,The typeswitch expression of XQuery allows users to write queries that are sensitive to dynamic type, yes it helps to avoid multiple nested if to fulfill this use case.
Regards,
Anuj
Edited by: Anuj Dwivedi, TCS on Jul 19, 2010 12:32 PM

Similar Messages

  • How to use Xqueries in OSB 10gR3 ?

    Hi,
    I have some trouble with OSB 10gR3 Xqueries.
    I try to extract (in a "FLWOR" loop ) the indexed i = 2 or i = 3 corresponding customer.
    I used 2 Xqueries to achieve it but I'm stuck. Can anyone help ?
    Thanks
    Query 1
    $body/sdf:updateCustomersResponse/sdf:ResponseData/sdf:customer[$index]
    Query 2
    $body/sdf:updateCustomersResponse/sdf:ResponseData/sdf:customer[2]
    Here is the input body used:
    <SOAP-ENV:Body      
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <ns:updateCustomersResponse      
         xmlns:ns="http://www.example.org/abc">
         <ns:ResponseData>
         <ns:customer>
         <ns:fax>00990001</ns:fax>
         <ns:tel>00991001</ns:tel>
         </ns:customer>
         <ns:customer>
         <ns:fax>00990002</ns:fax>
         <ns:tel>0099100100</ns:tel>
         </ns:customer>
         <ns:customer>
         <ns:fax>00990003</ns:fax>
         <ns:tel>00991222</ns:tel>
         </ns:customer>
         </ns:ResponseData>
    </ns:updateCustomersResponse>
    </SOAP-ENV:Body>
    When I use Query2
    $body/sdf:updateCustomersResponse/sdf:ResponseData/sdf:customer[2]
    I get the 2nd customer. It's correct.
         <ns:customer      
         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:ns="http://www.example.org/abc"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <ns:fax>00990002</ns:fax>
         <ns:tel>0099100100</ns:tel>
         </ns:customer>
    But I need to do parse all the customers (here 3)
    So I started to use such a query:     
    $body/sdf:updateCustomersResponse/sdf:ResponseData/sdf:customer[$index]
    In the OSB test console I define the value for $index as equal to 2 (no XML checked)
    But the Xquery returns all 3 customers and not the indexed one (e.g the first or the third)
    What is wrong ?
    Is there any clear example in the Oracle documentation to define the "Dynamic Xquery" ?(if this helps ?)
    <ns:customer      
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns="http://www.example.org/abc"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <ns:fax>00990001</ns:fax>
         <ns:tel>00991001</ns:tel>
         </ns:customer>
         <ns:customer      
         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:ns="http://www.example.org/abc"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <ns:fax>00990002</ns:fax>
         <ns:tel>0099100100</ns:tel>
         </ns:customer>
         <ns:customer      
         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:ns="http://www.example.org/abc"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <ns:fax>00990003</ns:fax>
         <ns:tel>00991222</ns:tel>
         </ns:customer>

    What do you want to do with each seperate customer record?
    Do you want to loop them in the osb flow itself, or from within a xquery (for each)
    if you want to do it from the flow itself youi use the flow control > for each
    For each variable 'mycustomer' in ./sdf:updateCustomersResponse/sdf:ResponseData/sdf:customer of variable 'body'
    indexed by variable 'mycustomer_i' with total count in variable 'customer_count'
    in an assign you can then use something like $mycustomer/ns:fax
    that's how it would look like in osb flow itself.
    Edited by: Eric Elzinga (IT-Eye) on Jan 12, 2010 9:05 AM

  • How to use caching in OSB

    Hi all,
    I am very new to the OSB. I have got one requirement in which I should create a cache
    to store the result for a certain period of time. The result would be a collection of employees
    which comes by invoking a webserivce service. We have a webservice which returns the employees
    based on the search criteria. If someone want the same list of employees we are hitting the web service again
    instead of that we are planning to cache the result of the search criteria and use them if the same request
    comes, rather than invoking the web service every time. For that, Is there anything available in OSB ?? if so how
    can I make use of it.. Kindly come up with your help please.
    Thanks & Regards,
    Phanindra.

    my the business service might return more than 10,000 records can I still go with the in built cache? or will it lead to performance issue?If you have enough memory resource available and following the best practices, you won't have any performance issue. It is highly scalable. Please refer -
    http://tomhofte.blogspot.com/2010/06/coherence-in-oracle-fusion-middleware.html
    http://blogs.oracle.com/MarkSmith/entry/osb_and_coherence_integration_1
    Regards,
    Anuj

  • How to use lookup in xquery(OSB)

    Hi
    In xquery , I have hardcoded the value and compare the hard coded value against input payload and fetch the corresponding value for hard coded value .
    In this way, I have hardcoded around 35 values in Xquery .
    But the client wants to use lookup or xref, some what like name value pair and not to use hard coding in xquery .
    Please let me know, how to implement in Xquery .

    Additionally you may refer this one also..
    http://guidoschmutz.wordpress.com/2009/12/25/implement-domain-value-maps-dvm-with-oracle-service-bus-osb-10r3/
    With custom Xpaths.
    http://beatechnologies.wordpress.com/tag/lookup-shared-dvm-in-osb/

  • 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 Use OSB's For Each to do this example?

    Hi All Friend:
    My XML From Assign . it SOAP Response Body variable is : RequestBussiNo. The Document is :
    <soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <DownloadBusinessNOResponse xmlns="http://www.taiji.com.cn/">
    <DownloadBusinessNOResult>
    <BusinessNO>
    <string>150100110262188</string>
    <string>150100110280225</string>
    <string>150100110284768</string>
    </BusinessNO>
    <ArraySize>3</ArraySize>
    <Result>true</Result>
    <ReturnCode>0000-Interface execute successed!</ReturnCode>
    </DownloadBusinessNOResult>
    </DownloadBusinessNOResponse>
    </soap:Body>
    I Don't Know How to Use For Each Function to each this Document Get the "string" tag text;
    my friend Please help me. thanks.

    Check the below thread and let us know if it helps
    Re: OSB:for-each action working procedure with a sample.
    Re: Assign activity erros with XPath query string returns multiple nodes.
    Regards,
    Ramesh

  • Writing a file using ssh in OSB 11g

    Hi
    OSB 11G
    Once I fetch from DB, i am able to write a flat file(delimiter with pipe) using Messaging Service and MFL.
    Now, my requirement is to write using SSH .
    Can anyone let me know how do I configure it in my Business Service?
    Thanks
    Edited by: soauser on Jul 12, 2011 9:08 AM

    OSB supports SSH File Transfer Protocol (SFTP) using SSH version 2 with SFTP transport -
    section "26.5 SFTP Transport" at http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/http_poller.htm#i1085854
    If existing options are not sufficient, you may also create custom transport using transport SDK and use that in OSB -
    http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/part_tsdk.htm#sthref954
    Regards,
    Anuj

  • How to use XmlModify to sort the XML Data?

    Hello,
    I saw some examples explain how to use XmlModify in BDB XML package. I want to sort the XML data by several elements but my Java program could not work correctly.
    <CustomerData>
    <Transaction>
    <DLSFIELDS>
    <ADR_PST_CD>12345</ADR_PST_CD>
    <CLT_IRD_NBR>002</CLT_IRD_NBR>
    </DLSFIELDS>
    </Transaction>
    <Transaction>
    <DLSFIELDS>
    <ADR_PST_CD>12345</ADR_PST_CD>
    <CLT_IRD_NBR>102</CLT_IRD_NBR>
    </DLSFIELDS>
    </Transaction>
    // many nodes like transaction ...
    </CustomerData>
    My XQuery script was executed successfully in the shell. The script looks as follows:
    "for $i in collection('sample.dbxml')/CustomerData/Transaction order by xs:decimal($i//ADR_PST_CD), xs:decimal($i//CLT_IRD_NBR) return $i".
    The Java code :
    // create XmlManager
    XmlManager manager = // ...;
    // open XmlContainer
    XmlContainer container = // ...;
    XmlQueryContext context = manager.createQueryContext(XmlQueryContext.LiveValues, XmlQueryContext.Eager);
    XmlQueryExpression expression = manager.prepare("for $i in collection('sample.dbxml')/CustomerData/Transaction order by xs:decimal($i//ADR_PST_CD),xs:decimal($i//CLT_IRD_NBR) return $i", context);
    XmlModify modify = manager.createModify();
    XmlUpdateContext uc = manager.createUpdateContext();
    XmlDocument xmldoc = container.getDocument("sample.xml");
    XmlValue value = new XmlValue(xmldoc);
    long numMod = modify.execute(value, context, uc);
    System.out.println("Peformed " + numMod     + " modification operations");
    Could you point out the errors above or offer some suggestion?
    Thanks.

    I have other question of the sorting issue. Here are a large XML need to sort so I have to split it to multiple small XML files. After importing these files, I will use the XmlModify and XQuery to sort them. I'm not clear on the multiple XML files processing.
    1. Can the BDB XML ensure that all these XML files were sorted or how to update all documents with same logic.
    2. If I want export all these sorted documents, how can I ensure these files processed in sequence? Which document needs process first?
    The export method:
    public void export(String outputfile)throws Exception{
    final int BLOCK_SIZE = 5 * 1024 * 1024; // 5Mb
    try{
    File theFile = new File(outputfile);
    FileOutputStream fos = new FileOutputStream(theFile);
    byte[] buff= new byte[BLOCK_SIZE];                         
    XmlResults rs = container.getAllDocuments(new XmlDocumentConfig());               
    while(rs.hasNext()){
         XmlDocument xmlDoc = rs.next().asDocument();
         XmlInputStream inputStream = xmlDoc.getContentAsXmlInputStream();                    
         long read=0;
         while(true){
         read = inputStream.readBytes(buff, BLOCK_SIZE);
    fos.write(buff,0,(int)read);                    
         if(read < BLOCK_SIZE) break;
    inputStream.delete();
    xmlDoc.delete();
    rs.delete();
    //MUST CLOSE!
    fos.close();               
    catch(Exception e){
    System.err.println("Error exporting file from container " + container);
    System.err.println(" Message: " + e.getMessage());
    Thanks.

  • How to use functions(to_char,to_date,trim..etc) in oracle xml table

    Hi I am new to oracle xml.
          In the below scenario how can use the functions like (to_char,To_date,trim..etc) In oracle xmltable."username","password" are inputs to my procedure.
    SELECT *
        INTO l_username,
                  l_password
        FROM xmltable('/InputParameters/ParamSet'
                        passing l_xmldoc
                        COLUMNS
                                l_username  VARCHAR2(28)    path 'username',
                                l_password VARCHAR2(28)     path 'password'
    and please Help how to write above with xmlquery.
    Thanks,

    In the same place you would for any regular SELECT statement
    SELECT TO_CHAR(...),
           TO_NUMBER(...)
      FROM random_table
    WHERE TO_CHAR(...) = col1
       AND TO_NUMBER(...) = col2
    username and password are the results of the SQL statement.  I'm guessing l_xmldoc is the input? There is not need to write something so simple as XQuery so what is your larger goal?  If you provide a clearer example and question, we can help you better.

  • How to use PasswordDigest to pass credentials in client (Jdev)

    Hi',
    I have a secured web service in OSB, and to call it I have created a proxy client in Jdev,
    I am able to call it by passing username/password using PasswordText, now I am not getting
    how to use PasswordDigest to pass credentials, please give me some pointers or sample,
    also do I need to perform some changes in the server before doing this.
    Thanks
    Yatan

    Please help

  • How to use mxf files with Premiere elements?

    Any ideas on how to use .mxf from my canon xf100 with elements? Also, I don't see a setting in the menu when I'm starting a project?

    http://www.google.com/#sclient=psy-ab&hl=en&q=convert+mxf+avi&oq=convert+mxf+avi&aq=f&aqi= g-v4&aql=&gs_l=hp.3..0i15l4.4835.9343.0.12811.15.13.0.2.2.0.168.1138.11j2.13.0...0.0.EDKQ8 U_mDpc&pbx=1&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=e3a93c99a6099aba&biw=1905&bih=701

  • OSB XQuery Maps

    Greetings!
    1]. I use OSB 10.3 with Eclipse (OSB Workshop that comes with OSB 10.3 installabe) IDE for doing mapping.
    I draw lines from Source to Target structure in XQuery Transformation. I see the source code getting build. When I close the XQuery and open it again in the IDE, I see all the source to target lines in the design view disappear. However the source code is still there. Any ideas what might be wrong here?
    2] In my XQuery transformation target structure for elements when I mounse over I see the Nodename, Namespace prefix and Namespace URI. However for some elements I see the namespace URI but no namespace prefix. This is causing problem because in the source code and in the output it produces there are elements without namespace prefix rendering the output invalid. I cant think of why for some elements there are no namespace prefixes. Any advise?
    Only think I can think of is that the target structure seem to have a cyclic reference in the schema.. pls see below example. Is this a problem?
    <a:element1>
    <b:element2>
    <a:element3>
    </b:element>
    </a:element1>
    3] I generated XQuery using mapforce for a map and when I tried to use it in OSB, it errored stating Recursive XQueryies are not supported in OSB. Any thots?
    Thanks in advance

    +2] In my XQuery transformation target structure for elements when I mounse over I see the Nodename, Namespace prefix and Namespace URI. However for some elements I see the namespace URI but no namespace prefix. This is causing problem because in the source code and in the output it produces there are elements without namespace prefix rendering the output invalid. I cant think of why for some elements there are no namespace prefixes. Any advise?+
    Only think I can think of is that the target structure seem to have a cyclic reference in the schema.. pls see below example. Is this a problem?
    +<a:element1>+
    +<b:element2>+
    +<a:element3>+
    +</b:element>+
    +</a:element1>+
    Schema cyclic reference was causing the problem with empty namespace. I had to go in to the XQuery and manually add the namespace and prefic and qualify the elements. After this data gets mapped

  • How to use resource servlet ?

    Hi all,
    Does any body know know how to use resource servlet to share resources (xsd, wsdl etc) in OSB ? Kindly provid eme witht the steps
    Thank you.

    Hi Eric,
    We can share the resource in the following way, but unfortunately OEPE doesnt accept http urls in schemaLocation arrtibute
    How can I get the WSDL/Policy/MFL/Schema/Proxy via HTTP?
    You can retrieve many of the resource types directly from the OSB server by using HTTP instead
    of needing to use the service bus console. The general pattern for the URL is as follows:
    http://[hostname]:[port]/sbresource?[Resource Type]/[Project Name]/[Resource Name]
    CHAPTER 18 ■ HOW DO I . . . ? 477
    The [Resource Type] section of the URL may be any one of the following values:
    • BIZ
    • MFL
    • POLICY
    • PROXY
    • SCHEMA
    • WSDL
    The URL must be UTF-8 encoded. If the resource is stored in a directory, then the directory
    structure needs to be declared explicitly in the URL also.
    For example, in the Hello World project in Chapter 4 of this book, we defined aWSDL resource
    in the WSDL folder of the project. The name of that WSDL resource is set to HelloWorld. To retrieve
    this WSDL, you would use the following URL:
    http://localhost:7001/sbresource?WSDL/Hello+World/WSDL/HelloWorld

  • Which component to chose in my use case ( BPEL / OSB / Mediator)

    All,
    I have gone through various blogs and documentation explaining the reasons for choosing a specific component,But,It is always a close call when it comes to making a very important decision as
    the real time uses case we generally deal with always fall in a border making it difficult to decide.
    Use case:
    A legacy system has to communicate with a third party system for sending some job details. For the same it uses an service intermediary.
    This service intermediary has to
    a) Receive the message from the legacy system. ( Preferably as EDN event as its easy for the legacy system to through an event)
    b) Very light orchestration ( in the future)
    c) Route it to the Mobile enablement application/ system.
    Generic:
    d) Need to provide a fault management / handling.
    e) Authentication / Authorization.
    Having these requirements, I thought an OSB would be a right component to be used as we are focused on routing in a decoupled way with light orchestration and business agility. However can OSB support
    a. subscribe to EDN events ? If yes how ? Can it have Oracle Apps adapter to get the events from R12 like BPEL?
    b. Can it use the same fault management framework written for SOA suite ( policies and bindings) ?
    On the other hand, I am having thoughts on why not use BPEL process itself. We can turn Auditing to off and will not have any dehydration points in the bpel process thus making it stateless ( just like OSB ?) if that is the major difference we are looking at ? Service virtualization ( dynamically changing the end point ) can also be acheived in bpel.
    and why not Mediator ? I know everywhere people talk about using mediator for intra composite commmunication but at the same time they suggest using it while writing to file / adapter or call a external service exposed as SOAP WSDL too. Now for our use case, a mediator can listen to events from the legacy system and route it to the target mobile enablement service.
    ( Note : BPEL and mediator can use fault management , EDN's, Oracle apps adapter and also can be made stateless by turning the audit to off . So if you are still suggesting OSB please back it up with strong reason rather than just theoritcally saying that its a standard to use in case of routing and stateless etc..)
    Kindly help !
    Regards,
    Sridhar.

    Realized that OSB can
    a. Read an AQ using AQ adapter and thus can subscribe to the Events raised using AQ in Oracle Ebsuiness Suite applications.
    b. OSB has its own way of handling faults. ( does not use SCA fault handling framework).
    The important question I want to focus here is
    In the above use case when everything can be acheived using either of OSB, BPEL or Mediator. ( ie., from ease of developement, performance and management) how to chose a specific component ?
    Service virtualization that OSB boasts can be done by BPEL.
    BPEL can also be made lieght weight by turning the dehydration to off ( auditing to off)
    Result cache can be achieved in bpel by using some custom coherence api.( which is one time effort and simple to use)
    Message throttling can be done using a queue in between.
    Really need a very practical reason to prefer OSB and not BPEL or Mediator in my case. Help appreciated

  • How to use Report Action.?

    How to use Report Action in OSB?
    How to Report the messages in the database of a system?
    I already have done RCU installation.
    IN RCU we know how to mention schema names but how to mention correct tablename where Reports gets stored is still a grey area..
    Kindly,Suggest
    Aryashree......

    Please refer -
    http://docs.oracle.com/cd/E21764_01/doc.1111/e15867/reporting.htm
    http://jvzoggel.wordpress.com/2012/01/18/osb_tracing_report_action/
    Regards,
    Anuj

Maybe you are looking for

  • A Short Recipe for Creating a secure Java Webserver

    This is a short note describing how I was able to implement a Java server on a secure website. I am writing this because I hope the rest of you will be able to navigate the SSL minefield more easily than I was able to do. I want to thank Brad Wetmore

  • Client Security Solution--and Password Manager--no longer autoruns

    My T61 was working wonderfully until recent installation of antispyware, antivirus programs. Prior to that, on boot, I could always see a brief CSS splash screen, and, more importantly, Password Manager would always kick in automatically, to load pas

  • Output Devices for Purchasing Groups

    Dear Friends/Gurus Please help me out on this issue We Configure Output Devices for Purchasing Groups in SPRO the path is SPRO-IMG-MM-Purchasing-Messages-Assign Output Devices for Purchasing Groups. I would like to know what is the Exact Usage of thi

  • From Mysql to Data Portal

    Dear All, I am new in DIAdem 12.0, I want to create a VBS script to create queries from a mysql server. Data is structured in different tables  and in its table data is structured in the way you see below , I want to find the sensors with the same se

  • Jcontrol is not starting up automatically

    Hello Gurus, Need your help with the issue am facing. We have installed a dual-stack (NW 7.0) system using export-import method. [export from source and installed target using system copy] Installation completed successfully, but when i check, only A