如何调用异步BPEL流程?

发布于 2024-11-05 17:56:49 字数 85 浏览 0 评论 0原文

我有一个异步 BPEL 流程,我想从我的 Java EE Web 应用程序调用它。我该怎么做?我正在使用 Oracle SOA-Suite 11g PS3。

I've got an asynchronous BPEL process and I wanna call it from my Java EE web application. How can I do this? I'm using Oracle SOA-Suite 11g PS3.

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

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

发布评论

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

评论(1

濫情▎り 2024-11-12 17:56:49

异步 SOAP/HTTP 发送方与同步 SOAP/HTTP 客户端基本相同,只是它会丢弃响应。仅检查响应的 HTTP 状态以验证接收者是否理解您的消息。

异步接收器基本上是一个 SOAP/HTTP 服务器,侦听请求的“ReplyTo/Adress”字段中发送的地址。收到消息后,它会发送带有“200”状态代码的空响应。

发送和接收的消息使用 WS-Addressing SOAP 标头字段“MessageID”(请求)和“RelatesTo”(响应)进行关联。

如果您对“低技术”解决方案感到满意,您可以像通过 HTTP 发送/接收 XML 一样发送/接收异步 SOAP 请求。以下 HTTP 请求将被 BPEL 流程“AsynchDummy”理解为异步请求。 AsynchDummy 是使用 JDeveloper 生成的默认异步 BPEL 流程:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" env:encodingStyle="">
  <env:Header>
    <ReplyTo xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing">
      <Address>http://localhost:3333/my/j2ee/servlet</Address>
      <PortType xmlns:ptns="http://xmlns.oracle.com/AsynchDummy">ptns:AsynchDummyCallback</PortType>
      <ServiceName xmlns:snns="http://xmlns.oracle.com/AsynchDummy">snns:AsynchDummyCallbackService</ServiceName>
    </ReplyTo>
    <MessageID xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing" ans1:rootId="610005" xmlns:ans1="http://schemas.oracle.com/bpel" ans1:parentId="160005" ans1:priority="0">ABC123</MessageID>
  </env:Header>
  <env:Body>
    <AsynchDummyProcessRequest xmlns="http://xmlns.oracle.com/AsynchDummy">
      <input>this is the request</input>
    </AsynchDummyProcessRequest>
  </env:Body>
</env:Envelope>

不要忘记将 SOAPAction HTTP 标头设置为 "initiate"(包括引号)。

您可以从 BPEL 流程的回调客户端步骤中得到类似的消息:

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Header xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:add="http://schemas.xmlsoap.org/ws/2003/03/addressing" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <add:RelatesTo>ABC123</add:RelatesTo>
    <add:MessageID ans1:rootId="" ans1:parentId="" ans1:priority="0" xmlns:ans1="http://schemas.oracle.com/bpel">ABC456</add:MessageID>
  </soap-env:Header>
  <soap-env:Body>
    <AsynchDummyProcessResponse xmlns="http://xmlns.oracle.com/AsynchDummy">
      <result>this is the result</result>
    </AsynchDummyProcessResponse>
  </soap-env:Body>
</soap-env:Envelope>

An Asynchronous SOAP/HTTP sender is basically the same as a Synchronous SOAP/HTTP client, just it throws away the response. Only check the HTTP status of the response to verify that the receiver understood your message.

An Asynchronous receiver is basically a SOAP/HTTP server listening on the address sent in the "ReplyTo/Adress" field of the request. After receiving the message it sends an empty response with a "200" status code.

The sent and received messages are correlated using the WS-Addressing SOAP header fields "MessageID" (request) and "RelatesTo" (response).

If you are happy with a "low-tech" solution, you can send/receive Asynch SOAP requests just as XML over HTTP. The following HTTP Request will be understood by the BPEL process "AsynchDummy" as an asynchronous request. AsynchDummy is the default asynchronous BPEL process generated with JDeveloper:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" env:encodingStyle="">
  <env:Header>
    <ReplyTo xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing">
      <Address>http://localhost:3333/my/j2ee/servlet</Address>
      <PortType xmlns:ptns="http://xmlns.oracle.com/AsynchDummy">ptns:AsynchDummyCallback</PortType>
      <ServiceName xmlns:snns="http://xmlns.oracle.com/AsynchDummy">snns:AsynchDummyCallbackService</ServiceName>
    </ReplyTo>
    <MessageID xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing" ans1:rootId="610005" xmlns:ans1="http://schemas.oracle.com/bpel" ans1:parentId="160005" ans1:priority="0">ABC123</MessageID>
  </env:Header>
  <env:Body>
    <AsynchDummyProcessRequest xmlns="http://xmlns.oracle.com/AsynchDummy">
      <input>this is the request</input>
    </AsynchDummyProcessRequest>
  </env:Body>
</env:Envelope>

Don't forget to set the SOAPAction HTTP header to "initiate" (including the quotation marks).

You can expect a similar message from the callback client step of the BPEL process:

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Header xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:add="http://schemas.xmlsoap.org/ws/2003/03/addressing" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <add:RelatesTo>ABC123</add:RelatesTo>
    <add:MessageID ans1:rootId="" ans1:parentId="" ans1:priority="0" xmlns:ans1="http://schemas.oracle.com/bpel">ABC456</add:MessageID>
  </soap-env:Header>
  <soap-env:Body>
    <AsynchDummyProcessResponse xmlns="http://xmlns.oracle.com/AsynchDummy">
      <result>this is the result</result>
    </AsynchDummyProcessResponse>
  </soap-env:Body>
</soap-env:Envelope>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文