Tuesday, September 02, 2014

Invoke Web service from Oracle Administrator Workflow

In our previous post

http://soa-bpel-esb.blogspot.in/2014/08/subscribe-business-event-using-oracle.html

We have seen how business events can be raised from Oracle Apps and using an Apps adapter oracle soa suite can subscribe to the message.

There are ways also where in one can directly call a web service from Oracle EBS by using the ACtion Invoke Web service.

In this exercise we will try to explore this option as how we can call a web service directly from Oracle EBS workflow.

The basic will remain the same as we have discussed in the previous post of event subscription. We will first create a one way BPEL service based on the following schmea

<?xml version= '1.0' encoding= 'UTF-8' ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org" targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:element name="Employee">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EmpName" type="xsd:string"/>
<xsd:element name="EmpId" type="xsd:integer"/>
<xsd:element name="EmpSalary" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

This porcess will only receive the event data and generate a BPEL instance.

I have create a simple one way process "WSDLCall" based on this schema.

Now go ahead and deploy your process and get the WSDL URL of your process from the em console.

To get the WSDL URL

Go to your em console.

Select your process and click on test button this will take you to a page from where you can copy the wsdl url as highlighted below



Now log on to Oracle EBS workflow page.

Go to Business Event tab--> Events and Create Event



Provide an event name and apply to create an event



Now go back to event page and search for the event you have created.

Once you find the Event click on subscription button to create a subscription for the event created.



Create a subscription

Provide the system name from the list of values

SourceType as local

Event Filter will have the name of the event.

Phase value keep it default value 100

Status Enabled

Rule Data is message

ACtion type -->Select this as "Invoke Web Service"

On Error -->Stop and Rollback



Say next and in the next page provide the WSDL URL that you have copied earlier



Next validate that the service name is selected correctly



Validate the port



Validate the operation name



Finally provide the owner name and tag and apply the changes



Now validate where a subscription is create for the Event or Not.



Now we are done with all the changes.

Now raise the event from the Workflow page.

Click on the Test button as shown



we will use the same payload that we have used in our last exercise

<xsd:Employee xmlns:xsd="http://www.example.org">
<xsd:EmpName>Arpit</xsd:EmpName>
<xsd:EmpId>2224</xsd:EmpId>
<xsd:EmpSalary>450000</xsd:EmpSalary>
</xsd:Employee>

Pass this payload in the XML Content as shown below and raise the event in Java as highlighted



Now log in to the em console and validate if the isntance is raised and it has the valid data.



Validate the data in the payload



Using an apps adapter is a better approach then directly calling a web service as tracking is much easier and better in case of apps adapter approach. Further when migrating code among instances the url keeps on changing so using a hard coded value is not a good approach. Or i should say using apps adapter to subscribe to business events is a better approach

No comments: