Java BPEL和selectionFailure错误
我是bpel新手,我只是在测试If-else。 我使用eclipse创建的bpel文件是: 它成功部署,没有错误,但当我尝试使用以下简单代码对其进行测试时:Java BPEL和selectionFailure错误,java,web-services,apache,axis,bpel,Java,Web Services,Apache,Axis,Bpel,我是bpel新手,我只是在测试If-else。 我使用eclipse创建的bpel文件是: 它成功部署,没有错误,但当我尝试使用以下简单代码对其进行测试时: try { tps.bpel.ifelse.IfElseSample_Service service = new tps.bpel.ifelse.IfElseSample_Service(); tps.bpel.ifelse.IfElseSample port = service.getIfElseSa
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);
}
我得到一个异常错误:
javax.xml.ws.soap.SOAPFaultException:axis2ns6575:selectionFailure
这里还有所有的。
我使用:
谢谢。BPEL标准要求在对其执行XPath查询之前初始化变量。在您的示例中,您正在为未初始化的输出变量赋值。由于未初始化的变量为空,XPath表达式
tns:result
不会选择任何节点,因此抛出selectionFailure。您需要首先初始化变量(例如,在开始时的
活动中)。EclipseBPEL设计器可以为您这样做(它通常会询问您是否要初始化变量)。代码大致如下所示:
<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>
$output.payload
奇怪的事情发生在我身上,我有一个版本1.6的BPEL在工作,我试图测试一些东西以在1.7中增加,但不喜欢它,所以将所有东西都恢复到1.6版本,清理/发布ode服务器,开始出现selectionFailure错误,用您的方式修复自动生成的初始化(只需要更改结果/输出名称,因为我已经更改了bpel中的名称)!非常感谢