Test Condition: XPath Expression not Working

81 views
Skip to first unread message

PeterS

unread,
Feb 25, 2011, 4:21:42 AM2/25/11
to BPELUnit
Hi there,

I have the following BPEL response from the HelloBPELProcess:

<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/">
<soapenv:Body>
<HelloBPELProcessResponse xmlns="http://www.se.uni-
hannover.de/soa08/tutorial/HelloBPELProcess">
<tns:result xmlns:tns="http://www.se.uni-
hannover.de/soa08/tutorial/HelloBPELProcess">Hello Donald</tns:result>
</HelloBPELProcessResponse>
</soapenv:Body>
</soapenv:Envelope>

When I use the XPath expressions:

//hel:result

or

//hel:HelloBPELProcessResponse/hel:result

my test passes as in the tutorial. When I use the full path however:

/soapenv:Envelope/soapenv:Body/hel:HelloBPELProcessResponse/
hel:results

it doesn't work. I have checked my XPath expression in another tool
and it should be equivalent. I am missing something?

Thanks,

Peter.

dluebke

unread,
Feb 25, 2011, 4:27:50 AM2/25/11
to BPELUnit
Hi Peter,

the reason why your absolute path expression doesn't work is that
BPELUnit already extracts the payload from the SOAP message before
evaluating the assertions. So what your XPath expressions see is the
following XML fragment without the envelope or body:

<HelloBPELProcessResponse xmlns="http://www.se.uni-
hannover.de/soa08/tutorial/HelloBPELProcess">
<tns:result xmlns:tns="http://www.se.uni-
hannover.de/soa08/tutorial/HelloBPELProcess">Hello Donald</tns:result>
</HelloBPELProcessResponse>

Based on this you should be able to use following expression:

/hel:HelleBPELProcessResponse/hel:result

Daniel

Peter Shillan

unread,
Feb 25, 2011, 4:33:14 AM2/25/11
to Daniel Lübke, bpel...@googlegroups.com
Hi Daniel,

Thanks for responding so quickly.  I had tried that but it didn't work.  I had a look at the different Receive Data Package items and it seems I have to use this:

/literalData/hel:HelloBPELProcessResponse/hel:result

Is BPELUnit adding the literalData tag and/or, is it because the process is document literal?

Thanks for your help,

Peter.

On 25 February 2011 09:26, Daniel Lübke <i...@daniel-luebke.de> wrote:
Hi Peter,

the reason why your absolute path expression doesn't work is that BPELUnit already extracts the payload from the SOAP message before evaluating the assertions. So what your XPath expressions see is the following XML fragment:


<HelloBPELProcessResponse xmlns="http://www.se.uni-
hannover.de/soa08/tutorial/HelloBPELProcess">
                       <tns:result xmlns:tns="http://www.se.uni-
hannover.de/soa08/tutorial/HelloBPELProcess">Hello Donald</tns:result>
</HelloBPELProcessResponse>

Based on this you should be able to use following expression:

/hel:HelleBPELProcessResponse/hel:result

Daniel





--
Peter Shillan

(<  07951 396253
peter....@gmail.com

Antonio García Domínguez

unread,
Feb 25, 2011, 4:35:24 AM2/25/11
to bpel...@googlegroups.com
Hi Peter,

In BPELUnit, XPath expressions are evaluated inside the envelope, I think. Try dropping the first component or two from that full path: it should work then.

Cheers,
Antonio
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

dluebke

unread,
Feb 25, 2011, 7:25:26 AM2/25/11
to BPELUnit
Hi,

sorry for not verifying my answer before sending it. The literalData
element wraps the response (in case there are several elements in case
of RPC/encoded I think). However, this part has been implemented by
Philip a long time ago and Philip isn't participating in the BPELUnit
project anymore, so there is noone really confirming the original
design intention. I just use // to seek into the message, although I
have to admit that it is a bit sloppy. I will take this up for
inclusion in the documentation because it is a very important point.

However, AFAIK the element name stays the same for RPC/encoded and doc/
lit services, so changing your WSDL description should not change this
element name.

Daniel
> peter.shil...@gmail.com

hongwei zhou

unread,
Mar 14, 2016, 11:13:12 PM3/14/16
to BPELUnit

Hi Daniel

I encountered a problem that is “org.apache.ode.axis2.OdeFault: SOAP body does not contain required part: payload” when I operate the instance “HelloBpelProcess”. Is it because the ode problem? The ode version is 1.3.6 and the HelloBPELProcessArtifacts.wsdl can be accessed correctly.


I have the following BPEL response from the HelloBPELProcess:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Body>

<soapenv:Fault xmlns:java="java:package org.apache.ode.axis2">

<faultcode>java:org.apache.ode.axis2.OdeFault</faultcode>

<faultstring>SOAP body does not contain required part: payload.</faultstring>

<detail>

<Exception>org.apache.ode.axis2.OdeFault: SOAP body does not contain required part: payload.&#13;

         at org.apache.ode.axis2.ODEService.onAxisMessageExchange(ODEService.java:147)&#13;

         …

org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)&#13;

         at java.lang.Thread.run(Thread.java:745)&#13;

Caused by: org.apache.ode.axis2.OdeFault: SOAP body does not contain required part: payload.&#13;

         at org.apache.ode.axis2.util.SoapMessageConverter.extractSoapBodyParts(SoapMessageConverter.java:404)&#13;

         at org.apache.ode.axis2.util.SoapMessageConverter.parseSoapRequest(SoapMessageConverter.java:325)&#13;

         at org.apache.ode.axis2.ODEService.onAxisMessageExchange(ODEService.java:118)&#13;

         ... 29 more&#13;

Caused by: java.lang.IllegalArgumentException: SOAP body does not contain required part: payload.&#13;

         at org.apache.ode.utils.wsdl.Messages.msgSOAPBodyDoesNotContainRequiredPart(Messages.java:146)&#13;

         ... 32 more&#13;

</Exception>

</detail>

</soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>

 

Could you please tell me the solution about the problem?

Thank you

Hongwei Zhou


在 2011年2月25日星期五 UTC+8下午8:25:26,Daniel Lübke写道:

Daniel Lübke

unread,
Mar 15, 2016, 8:16:39 AM3/15/16
to BPELUnit
Hi,

without the process and the test suite I cannot really tell the problem. It looks like the input SOAP message could not be processed by Apache ODE. Did you enter data for the send activity? If yes, can you please post the excerpt for the send or sendReceive activity that you are using and the WSDL?

Daniel

hongwei zhou

unread,
Mar 16, 2016, 1:42:49 AM3/16/16
to BPELUnit
Hi Daniel,

The wsdl is correct. Just as the picture follows.


 set the send/Receive

The SOAP Error


Thank you for your help!

Hongwei Zhou




在 2016年3月15日星期二 UTC+8下午8:16:39,Daniel Lübke写道:

Daniel Lübke

unread,
Mar 17, 2016, 2:40:53 PM3/17/16
to BPELUnit
Hi,

I am sure the WSDL is correct because ODE would otherwise refuse to deploy the process. However, I need to know the contents of the WSDL and the BPTS in order to see if the message exchange in the test case is configured correctly. Can you please provide me those two?

Daniel

hongwei zhou

unread,
Mar 18, 2016, 3:10:00 AM3/18/16
to BPELUnit

Hi Daniel,

I tried some ways,but it still has not been resolved. The total project has been uploaded to the attachment.

 

If you have find any ways to slove the problem,please tell me.  Thank you very much for your kind help.

Hongwei Zhou




在 2016年3月18日星期五 UTC+8上午2:40:53,Daniel Lübke写道:
pro9.zip

Daniel Lübke

unread,
Mar 21, 2016, 2:59:26 PM3/21/16
to BPELUnit
Hi,

you have not defined any data to be sent to the process:

<tes:send service="sam:HelloBPELProcessService" port="HelloBPELProcessPort" operation="process" fault="false">
  <tes:data/>
</tes:send>


Instead of <tes:data/> there should be <tes:data><yourmessagedata/></tes:data> With yourmessagedata being a compliant message to the process according to the WSDL (without the SOAP envelope and body which will be added by the BPELUnit test framework).

Daniel
Reply all
Reply to author
Forward
0 new messages