BPEL 和选择失败错误
我是 bpel 的新手,我只是测试 If-else。 我使用 eclipse 创建的 bpel 文件是: IfElseSample.bpel
它成功部署,没有错误,但是当我尝试使用简单的代码测试它时,例如:
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
这里还有我的 Eclipse 项目。 我使用:
- apache-tomcat-7.0.23
- apache-ode-war-1.3.5
- 面向 Web 开发人员的 Eclipse Java EE IDE。版本:Indigo Service Release 1
谢谢。
I'm new to bpel and i'm just testing an If-else.
The bpel file that i've been created using eclipse is: IfElseSample.bpel
It successfully deployed with no errors but when I try to test it using simple code like:
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 here is all of my eclipse project.
and I use:
- apache-tomcat-7.0.23
- apache-ode-war-1.3.5
- Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 1
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

BPEL 标准要求在对其执行 XPath 查询之前先初始化变量。在您的示例中,您正在为未初始化的输出变量赋值。由于未初始化的变量为空,因此 XPath 表达式 tns:result 不会选择任何节点,从而引发选择失败。您需要首先初始化变量(例如在开头的
活动中)。 Eclipse BPEL 设计器可以为您做到这一点(它通常询问您是否要初始化变量)。代码应该大致如下所示:The BPEL standard requires variables to be initialized before XPath queries can be performed on it. In your example, you are assigning values to the uninitialized output variable. Since an uninitialized variable is empty, the XPath expression
tns:result
does not select any node and thus throws a selectionFailure. You will need to initialize the variable first (e.g. in an<assign>
activity at the beginning). The Eclipse BPEL designer can do that for you (it usually asks you if you want to initialize the variable). The code should look roughly like this: