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