javaweb服务与BPEL

javaweb服务与BPEL,java,web-services,bpel,Java,Web Services,Bpel,我正在努力尝试使用这个web服务(它与家庭作业相关,但不是实际的家庭作业)。这个BPEL流程似乎提供了异步回调,我只是不确定它到底是如何使用的。 wsimport生成了以下类: > AttributedQName.java > AttributedURI.java > EndpointReferenceType.java > N6368808CreditFlow.java > N6368808CreditFlowCallback.java > N6368808

我正在努力尝试使用这个web服务(它与家庭作业相关,但不是实际的家庭作业)。这个BPEL流程似乎提供了异步回调,我只是不确定它到底是如何使用的。 wsimport生成了以下类:

> AttributedQName.java
> AttributedURI.java
> EndpointReferenceType.java
> N6368808CreditFlow.java
> N6368808CreditFlowCallback.java
> N6368808CreditFlowCallbackService.java
> N6368808CreditFlowProcessRequest.java
> N6368808CreditFlowProcessResponse.java
> N6368808CreditFlow_Service.java
> ObjectFactory.java
> ReferencePropertiesType.java
> Relationship.java ServiceNameType.java
> package-info.java
N6368808CreditFlow.java是initiate方法的接口,我假设credit方法是唯一可用的方法,它将请求作为参数。而N6368808CreditFlowCallback.java包含一个onResult方法,该方法将响应作为参数

如何使用这项服务?我已经能够调用该方法,但没有得到返回的响应(不确定如何获得响应,因为onResult方法不做任何事情,initiate方法返回void(甚至没有回调或响应))

以下是我目前的代码:

    N6368808CreditFlow_Service service1 = new N6368808CreditFlow_Service();
    N6368808CreditFlow port = service1.getN6368808CreditFlowPort();
    N6368808CreditFlowProcessRequest rqt = new N6368808CreditFlowProcessRequest();
    rqt.setSsn("123456789");
    port.initiate(rqt);
    System.out.println("Done");
根据BPEL控制台的工作原理和给出的“123456789”,我的问题是如何得到响应

以下是来自BPEL源代码的片段:

<sequence name="main">

<!--

 Receive input from requestor. (Note: This maps to operation defined in n6368808_CreditFlow.wsdl) 

-->

<receive name="receiveInput" partnerLink="client" portType="client:n6368808_CreditFlow" operation="initiate" variable="inputVariable" createInstance="yes"/>

<!--


          Asynchronous callback to the requester. (Note: the callback location and correlation id is transparently handled using WS-addressing.)


-->

- <scope name="getCreditRating">

- <sequence name="Sequence_1">

- <assign name="assign_SSN">

- <copy>

<from variable="inputVariable" part="payload" query="/client:n6368808_CreditFlowProcessRequest/client:ssn"/>

<to variable="invoke_CRS_process_InputVariable" part="payload" query="/ns1:ssn"/>

</copy>

</assign>

<invoke name="invoke_CRS" partnerLink="CreditRatingService" portType="ns1:CreditRatingService" operation="process" inputVariable="invoke_CRS_process_InputVariable" outputVariable="invoke_CRS_process_OutputVariable"/>

- <assign name="return_SSN">

- <copy>

<from variable="invoke_CRS_process_OutputVariable" part="payload" query="/ns1:rating"/>

<to variable="outputVariable" part="payload" query="/client:n6368808_CreditFlowProcessResponse/client:creditRating"/>

</copy>

</assign>

</sequence>

</scope>

<invoke name="callbackClient" partnerLink="client" portType="client:n6368808_CreditFlowCallback" operation="onResult" inputVariable="outputVariable"/>

</sequence>

</process>

- 
- 
- 
- 
- 
- 

您的BPEL流程确实是异步的,流程实例在接收活动使用消息时启动,响应通过调用活动发送。为了接收响应,Java客户端需要打开一个实现客户端的Web服务端点:n6368808_CreditFlowCallback端口类型。BPEL引擎如何确定回调的端点地址是特定于引擎的。从理论上讲,合作伙伴链接的合作伙伴角色使用接收到的消息进行初始化(即消息需要与回调EPR通信)。但是,这取决于BPEL引擎是否以及如何实现合作伙伴角色的初始化

通常我建议使用异步流程建模范式,因为它始终支持长时间运行的流程。但是,如果使用异步传输协议(如JMS),或者完全确定被调用的Web服务正在运行(即,整个处理不太可能比HTTP连接超时),则可以考虑将进程建模为同步,用应答替换调用。(指向与接收相同的partnerlink、端口类型和操作)。如果有疑问,请坚持使用异步模型