I am having one requirement where I need to fetch each productOrderItem
from request but this element is not part of input schema type. It will be
extended during runtime.
I have create BPEL2.0
Synchronous process and add one assign activity. Now I need to count productOrderItem
node to a variable say count. But BPEL will not allow us to compile code with
abstract path.
Solution: Use bpws:getVariableData() BPEL1.1 syntax or ora:countNodes
ora:countNodes('$inputVariable','payload','/client:customerDetails/client:productOrderItem')
OR
count(bpws:getVariableData('$inputVariable','payload','/client:customerDetails/client:productOrderItem'))
Test: After deployment open em console and paste below
request
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:process
xmlns:ns1="http://xmlns.oracle.com/POCs/AbstractpathProject/BPELProcess">
<ns1:OrderID>1111</ns1:OrderID>
<ns1:customerDetails>
<ns1:customerId>1234</ns1:customerId>
<ns1:orderStatus>Submitted</ns1:orderStatus>
<ns1:orderSubStatus>Confirmed</ns1:orderSubStatus>
<ns1:productName>D2H</ns1:productName>
<ns1:productOrderItem>
<ns1:action>ADD</ns1:action>
<ns1:description>D2H
Package</ns1:description>
<ns1:name>D2H
Gold</ns1:name>
<ns1:objectType>Loyalty
Package</ns1:objectType>
<ns1:productPrices>
<ns1:productPrice>
<ns1:description>Loyalty
Package</ns1:description>
<ns1:name>Loyalty
Package</ns1:name>
<ns1:price
amount="15.0">
<ns1:currency>
<ns1:code>EUR</ns1:code>
<ns1:symbol>€</ns1:symbol>
</ns1:currency>
</ns1:price>
<ns1:priceAlteration/>
<ns1:period>MONTHLY</ns1:period>
</ns1:productPrice>
</ns1:productPrices>
</ns1:productOrderItem>
</ns1:process>
</soap:Body>
</soap:Envelope>
Test result should have count of 1 for productOrderItem
but getting zero
|
Solution: BPEL 2.0 done not support / in location.
Modify like below
Modify like below
OLD:ora:countNodes('$inputVariable','payload','client:customerDetails/client:productOrderItem')
NEW:ora:countNodes('$inputVariable','payload','/client:customerDetails/client:productOrderItem')
<count>
<count xsi:type="def:string">1</count>
</count>