keskiviikko 10. huhtikuuta 2013

Tutorial 1 part 28 - calling external service from BPEL flow

Using the newly added service in BPEL flow
Now we can start calling that service in our BPEL flow.
Double-click on the GeoFenceEventHandler on the composite.xml.
Add an invoke between the receive and reply activities. 

Draw a line from it to the newly added web service. This starts a dialog

Define also a name for the input and output variables (note the different tabs for input and output at the botton). Use the green plus sign.

For input use: InvokeReservationSystem_InputVariable
For output use: InvokeReservationSystem_OuputVariable

Next we need to prepare the variable for the invoke operation. This is done with an assignment operation. Drag and drop it before the invoke operation. Double-click on it.

Change name to AssingReservationSystemParams (from general tab)
Open up the input variable for the process on the left and the newly added input parameter on the right and drag a line between the AssetId and the license_number. This will create a copy operation.

Now we have a process that accepts events from the hypothetical m2m platform and calls the reservations system. So far it does not really do anything else but we are at a phase where we can try to deploy it and see how it behaves by testing it.

Note: Sometimes when you try to deploy, you may notice a mistake  when you create BPEL processes. There is a checkbox about creating a new instance automatically (it is not visible if you base you BPEL flow from a WSDL and say to expose it via SOPA but you will see if you do not have a ready made WSDL and want the wizard to automatically create a interface definition for you. If you do not check the checkbox you will see an error “no start acticity” (I had this error in first try of this demo).  This I easy to fix. Click on the error and jDeveloper will take you to the erroneous line. It will be something like:
<receive name="ReceiveGeoFenceEvent" createInstance="no"
             partnerLink="GeoFenceEventSvc" portType="ns1:Read_ptt"
             operation="Read" variable="ReceiveGeoFenceEvent_InputVariable"/>
We need to change the createInstance to “yes”. This means that for each new request coming in, a new process instance will be started.
---end note

Test with enterprise manager
1.       Logon.
2.       Go to Farm Domain 1->SOA->soa-infra->simpletutorial (or whatever partition you deployed to)->GeoFenceSvc
3.       Press Test tab
4.       Fill in values and press “Test Web Service” button

Ei kommentteja:

Lähetä kommentti