BPEL and selection error

I am new to bpel and I am just testing If-else. The bpel file that was created using eclipse is: IfElseSample.bpel

It was successfully deployed without errors, but when I try to test it using simple code, for example:

try { tps.bpel.ifelse.IfElseSample_Service service = new tps.bpel.ifelse.IfElseSample_Service(); tps.bpel.ifelse.IfElseSample port = service.getIfElseSamplePort(); tps.bpel.ifelse.IfElseSampleRequest payload = new tps.bpel.ifelse.IfElseSampleRequest(); payload.setInput("John"); tps.bpel.ifelse.IfElseSampleResponse result = port.process(payload); //Exception occur here System.out.println("Result = "+result); } catch (Exception ex) { System.out.println("Exception=> "+ex); } 

I got an exception error:

javax.xml.ws.soap.SOAPFaultException: axis2ns6575: selectionFailure

Also presented here is my eclipse project . and I use:

  • apache cat 7.0.23
  • Apache Ode of War 1.3.5
  • Eclipse Java EE IDE for web developers. Version: Indigo Service Release 1

Thanks.

+4
source share
1 answer

The BPEL standard requires that variables be initialized before XPath queries can be executed on it. In your example, you are assigning values ​​to an uninitialized output variable. Since the uninitialized variable is empty, the XPath tns:result expression does not select node and thus throws selectionFailure. First you need to initialize the variable (for example, at the beginning of <assign> ). The Eclipse BPEL designer can do this for you (he usually asks you if you want to initialize the variable). The code should look something like this:

 <bpel:assign> <bpel:copy> <bpel:from> <bpel:literal> <payload><tns:result/></payload> </bpel:literal> </bpel:from> <bpel:to>$output.payload</bpel:to> </bpel:copy> </bpel:assign> 
+3
source

Source: https://habr.com/ru/post/1387928/


All Articles