8 Replies Latest reply: Nov 18, 2012 4:36 PM by vladodias RSS

    DVM with OSB

    veejai24
      Hi All,

      Wanted to implement DVM with OSB.

      Follwed the below URL and tried to implement as is.

      https://blogs.oracle.com/christomkins/entry/domain_value_maps_in_oracle_se

      Created project, created XQuery with DVM information, created XQuery to get those values from DVM.
      But when i run iam getting the following error message


      Error Message:
      <error>Error occurred while executing XQuery: line 10, column 9: {err}FORG0005: expected exactly one item, got 0 items. Either the XQuery is invalid or it contains custom XQuery functions. Try using the web test console to test this XQuery (Right click on the XQuery file and select Run As ->Run On Server) </error>

      The below line is creating problem:

      *$dvm/ns0:rows/ns0:row[ns0:cell[1]=$airportName]/ns0:cell[2]* - This xpath is throwing the exception.

      Thanks,
      Vijay
        • 1. Re: DVM with OSB
          vladodias
          Hi,

          Difficult to figure out without knowing the contents of $dvm and $airportName... But the message suggests the value was not found... Either your having and airport name that is not in the list... Or the list is empty/incomplete...

          Cheers,
          Vlad
          • 2. Re: DVM with OSB
            veejai24
            Thanks Vlad for your response, I have pasted below the DVM file.

            +<dvm name="airportCodes" xmlns="http://xmlns.oracle.com/dvm">+
            +<description>This is description</description>+
            +<columns>+
            +<column name="Airport Name"/>+
            +<column name="Airport Code"/>+
            +</columns>+
            +<rows>+
            +<row>+
            +<cell>London Heathrow</cell>+
            +<cell>LHR</cell>+
            +</row>+
            +<row>+
            +<cell>Dublin</cell>+
            +<cell>DUB</cell>+
            +</row>+
            +<row>+
            +<cell>Liverpool</cell>+
            +<cell>LIV</cell>+
            +</row>+
            +</rows>+
            +</dvm>+

            and i have the standard dvm.xsd file as schema file.

            This below Xquery is used, to get the value from above DVM file.

            +(:: pragma bea:global-element-parameter parameter="$dvm" element="ns0:dvm" location="dvm.xsd" ::)+

            declare namespace ns2 = "";
            declare namespace ns0 = "http://xmlns.oracle.com/dvm";
            declare namespace xf = "http://tempuri.org/SimpleOSBv1/SimpleDVM/";

            declare function xf:SimpleDVM($dvm as element(ns0:dvm),
            +$airportName as xs:string)+
            +as xs:string {+
            +$dvm/ns0:rows/ns0:row/ns0:cell[1]+
            +};+

            declare variable $dvm as element(ns0:dvm) external;
            declare variable $airportName as xs:string external;

            xf:SimpleDVM($dvm,
            +$airportName)+


            Thanks,
            Vijay
            • 3. Re: DVM with OSB
              vladodias
              There is nothing wrong with the code... Check the parameters that are being passed, extra spaces in $airportName will be enough to cause the error message...

              I'm also assuming you originally had this...
              $dvm/ns0:rows/ns0:row[ns0:cell[1]=$airportName]/ns0:cell[2]
              rather than this...
              veejai24 wrote:
              +$dvm/ns0:rows/ns0:row/ns0:cell[1]+
              You may also try this...
              let $a := $dvm/ns0:rows/ns0:row[ns0:cell[1]=$airportName]/ns0:cell[2]
              return if ($a)
              then $a
              else concat("[",$airportName,"] NOT FOUND!")
              Cheers,
              Vlad
              • 4. Re: DVM with OSB
                veejai24
                Thanks Vlad. The XQuery is not able to refer the data file where the airport names and codes are lying.

                For whatever the airport name you try, the result is not found. :(

                I have kept the files with in the same folder, but do we need to explicitly mention in the xquery about the source file ?

                Thanks,
                Vijay
                • 5. Re: DVM with OSB
                  PrazzyJay
                  I think you should provide DVM contents as first parameter and Airport name as second parameter while calling the Xquery.

                  --Prasanna                                                                                                                                                                                                                                                                               
                  • 6. Re: DVM with OSB
                    PrazzyJay
                    And to create a Variable with DVM values use the Xquery transformation you created using the DVM file.

                    --Prasanna                                                                                                                                                                                                                                       
                    • 7. Re: DVM with OSB
                      veejai24
                      I think i have both, the schema and the dvm data, but some how the data is not flowing through the XQuery.

                      I am missing something here, how to pass the dvm data to XQuery.

                      Thanks,
                      Vijay
                      • 8. Re: DVM with OSB
                        vladodias
                        veejai24 wrote:
                        I am missing something here, how to pass the dvm data to XQuery.
                        I believe you should have the data into a variable and then "bind" it to your xquery... Use a log activity to check if the data is coming alright...

                        Are you being able to read the xml contents, you can do it with doc function if you know the absolute path
                        Re: OSB: How read file xml that is into project OSB

                        Or just upload the xml data as a xquery resource into the OSB project (rename it to .xq)... Not really a beauty, but works...

                        Or use something like this...
                        http://gibaholms.wordpress.com/2012/02/23/read-xml-resource-in-oracle-service-bus-11g/

                        Cheers,
                        Vlad