Forum Stats

  • 3,854,261 Users
  • 2,264,344 Discussions
  • 7,905,624 Comments

Discussions

Oracle Design Studio (OSM): Data dictionary stays unpopulated even after extraction in xquery code

6659fe49-583e-49a2-96a5-7acdf019d957
edited Mar 23, 2019 6:21AM in XQuery

I want to extract productItem data from the data catalog, but I still see the data unpopulated on the console. Please review my code to let me know if there's something I'm missing, because I've spent an entire day and had several colleagues look it over with no productive solution.

I've tried debugging the code by hardcoding a value in the "productItem" tag, which does appear on the OrderManagement console. It seems like it may not be a problem in the code, but a problem with the data that I am trying to extract. The code I have written is as follows:

import module namespace orderdetails = "orderdetails" at "http://xmlns.ptcl.com/ordermanagement/somorderfulfillment/utilities/functions/OrderDetailsMappingModule.xquery";

declare namespace oms= "urn:com:metasolv:xmlapi:1";

declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.ScriptReceiverContextInvocation";

declare namespace context = "java:com.mslv.oms.automation.TaskContext";

declare namespace log = "java:org.apache.commons.logging.Log";

declare namespace saxon = "http://saxon.sf.net/";

declare namespace xsl = "http://www.w3.org/1999/XSL/Transform";

declare namespace cat= "http://www.ibm.com/decomposeCustomerOrderService/";

declare variable $automator external;

declare variable $context external;

declare variable $log external;

declare option saxon:output "method=xml";

declare option saxon:output "saxon:indent-spaces=4";

let $catalogResponse := .

let $orderNumber := $catalogResponse/decomposeCustomerOrder/orderNumber/text()

let $CatalogResponseCode := $catalogResponse/returnCode/text()

let $taskDataOrder := fn:root(automator:getOrderAsDOM($automator))/oms:GetOrder.Response

(:let $offeredService:= $catalogResponse/decomposeCustomerOrder/offeredServices/item:)

let $xmlSerialized := saxon:serialize($catalogResponse, <xsl:output method='xml' omit-xml-declaration='yes' indent='yes' saxon:indent-spaces='4'/>)

let $logStr := fn:concat($orderNumber,"|Catalog Response Received|",$xmlSerialized)

return

    (

    automator:setUpdateOrder($automator, 'true'),

    <OrderDataUpdate>

        <UpdatedNodes>

            <_root>

                <decompositionDetails>

                    <productsList>

                    {

for $productItem in $catalogResponse/decomposeCustomerOrder/offeredServices/item/products/item

let $idProductItem := $productItem/id/text()

let $CFSItems := $catalogResponse/decomposeCustomerOrder/offeredServices/item/customerServices/item[parentProduct/id/text() = $idProductItem]

let $logStr1 := fn:concat("|ID Product ITEM |",$idProductItem)

return

log:info($log,$logStr1),

<productItem>

<productID>{$productItem/text()}</productID>

</productItem>,

log:info($log,"After product Item close tag")

}

                    </productsList>

                </decompositionDetails>

            </_root>

        </UpdatedNodes>

    </OrderDataUpdate>,

log:info($log, $logStr),

    context:completeTaskOnExit($context, 'success')

    )

I am expecting to see the data populated when I see the order in the OrderManagement console. However, the "productItem" view is seen empty, as shown below:

IMAGE$652427A96205796B.jpg

Answers

  • tsuji
    tsuji Member Posts: 179 Bronze Badge
    edited Mar 23, 2019 6:21AM

    Late, but I have taken a look. Modulo all the uncertainties derived from the source xml and binding of externals etc, I can only comment on the syntactical aspect of the code... The return code of the sub-query for the emission of the productItem poses some doubt it seems to me. Try wrapping the return sequence with parentheses which is the correct way to do it see if it rectifies the problem (otherwise something should appear in the error log, if there is one, that you can inspect and check for.)

                        <productsList>                    {for $productItem in $catalogResponse/decomposeCustomerOrder/offeredServices/item/products/itemlet $idProductItem := $productItem/id/text()let $CFSItems := $catalogResponse/decomposeCustomerOrder/offeredServices/item/customerServices/item[parentProduct/id/text() = $idProductItem]let $logStr1 := fn:concat("|ID Product ITEM |",$idProductItem)return(log:info($log,$logStr1),<productItem><productID>{$productItem/text()}</productID></productItem>,log:info($log,"After product Item close tag"))                     }                    </productsList>