How to Create a Simple Addition Web Service in Oracle SOA
Here I`ll show you a step by step procedure to create a SOAP based Addition Web service in Oracle Jdeveloper.
Step 1: Create a SOA Project in Jdeveloper.
Here we can see the three columns called as swim lanes
- Exposed Services – Used for Inbound services from where we will get request which is also called Source System
- External References – Used for Outbound services where we use to send request to external system which is also called target system
- Components – Used to develop integrations also called as Workspace.
Step 2: Drag and Drop BEPL Process in to the Workspace
BEPL Process is used to implement internal functionality of the Web Service. This helps in receiving input from external web service, invoke a web service adapter, reply to the web service and performs many activities that are involved in implementing a web service.
In this project we are using Synchronous Web Service as it sends a response back to Client after completing its operations.
Here we can see the check box Expose as a SOAP Service (checked by default). This creates a new SOAP web service in the Exposed services side (i.e., to the left of BPEL).
It also generates an XML Schema with input as “process” and output as “processResponse”
Step 3: Now edit the XML Schema file that has been generated under Schemas folder. Here we need to edit “BPELProcess1.xsd” which is under the Schemas folder.
The XML Schema defines the structure of request and response objects.
Here the “Process” element defines the Input/request object that will be sent as a request (XML file) to the web service, whereas the “processResponse” element defines the Output/response object that will be the response generated by the web service (XML file).
Here we need two integer values as input for our addition service which in return generates the sum of the two integers (i.e., one output).
So we update the process element with two inputs of type integer and processResponse element with one output variable (can be String or Integer) and save it.
Step 4: Now Double click on the BEPL process for implementing Addition operation. Here you can see the SOAP web service in partner links lane linked with receive service (recieveInput) and reply service (replyOutput) in the workflow.
Step 5: Drag and drop Assign activity on to the workspace next to the Receive service. To Map the received input and response output as shown below.
Step 6: Implement Addition Operation in Assign Activity
- Double Click on the Assign Activity
- Expand the input in the Left side and output to the Right side
- Drag and drop the expression on the output variable (or) Right click on the output variable and click on the expression.
- Double click on the input variables to add its XPATH to the expression and use functions to perform operations (here I used add function i.e., +)
Step 7: Now deploy the project on to SOA Server.