Bug 809065

Summary: requst xml iteration using foreach is not working
Product: [JBoss] JBoss Enterprise SOA Platform 5 Reporter: Ravi <ravi.evani>
Component: riftsawAssignee: Gary Brown <gbrown>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 5.2.0 GACC: soa-p-jira
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Dev
Last Closed: 2012-04-12 08:12:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
loopTestProject none

Description Ravi 2012-04-02 11:42:43 UTC
Description of problem:
Unable to retrieve an element from a list using XPath 1.0in BPEL 2.0 using 'foreach' counter variable.

Version-Release number of selected component (if applicable):
SOA Platform 5.2.0 GA


How reproducible:
Attached the project

Steps to Reproduce:
1.Deploy loopTest project to SOA paltform 5.2.0 GA 
2.Test the wsdl 'http://localhost:8080/looptest?wsdl' in soap ui and test with loopTestReq.xml


3.  
Actual results:
Getting an error
<faultcode xmlns:valueNS="_http://docs.oasis-open.org/wsbpel/2.0/process/executable">valueNSelectionFailure</faultcode>

Expected results:
Should return 2nd element

Additional info:
I am trying to send a request (attached) with a employee-info list of zise 3.
Defined a foreach  loop like below
  <bpel:forEach parallel="no" counterName="Counter" name="ForEach">
            <bpel:startCounterValue><![CDATA[1]]></bpel:startCounterValue>
            <bpel:finalCounterValue><![CDATA[count($input.payload/tns:employee-list/tns:employee-info)]]></bpel:finalCounterValue>
       and trying to retrieve the 2nd element using below expression.
 <![CDATA[$input.payload/tns:employee-list/tns:employee-info[$Counter]/tns:emp-id]]>

Comment 1 Ravi 2012-04-02 11:43:24 UTC
Created attachment 574473 [details]
loopTestProject

Comment 2 Gary Brown 2012-04-02 15:12:17 UTC
Two suggestions,

1) Change the xpath expression to be:

<![CDATA[$input.payload/tns:employee-list/tns:employee-info[position()=$Counter]/tns:emp-id]]>


and if that does not work,

2) Try both variations with:

<bpelrocess name="..."
         ....
         queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublangpath2.0"
         expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublangpath2.0">


and remove any 'queryLanguage' attribute in the remainder of the process definition.


If you could let us know the results of these two suggestions.

Comment 3 Ravi 2012-04-12 04:30:56 UTC
Hi Gary,

Sorry for the delayed reply and thanks a lot for your suggestions.

The xpath expression with [position()=$Counter] and queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublangpath2.0"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublangpath2.0"

is working fine.

Thanks,
Ravi

Comment 4 Gary Brown 2012-04-12 08:12:30 UTC
Ok thanks Ravi, I'll close this issue then.