BPEL 和选择失败错误

发布于 12-22 23:08 字数 1190 浏览 4 评论 0原文

我是 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 项目。 我使用:

  1. apa​​che-tomcat-7.0.23
  2. apache-ode-war-1.3.5
  3. 面向 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:

  1. apache-tomcat-7.0.23
  2. apache-ode-war-1.3.5
  3. Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 1

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

意中人2024-12-29 23:08:51

BPEL 标准要求在对其执行 XPath 查询之前先初始化变量。在您的示例中,您正在为未初始化的输出变量赋值。由于未初始化的变量为空,因此 XPath 表达式 tns:result 不会选择任何节点,从而引发选择失败。您需要首先初始化变量(例如在开头的 活动中)。 Eclipse BPEL 设计器可以为您做到这一点(它通常询问您是否要初始化变量)。代码应该大致如下所示:

<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>

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:

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文