In this post, we are going to cover What is REST in SOA 12c and Steps to Create REST in SOA 12c which is one of the new features in SOA 12c. For those who are new, REST stands for Representational State Transfer.
What is REST in SOA 12c:
REST is an Architectural style in which a web service can only be treated as a RESTful service if it follows the constraints of being
- Client-Server
- Stateless
- Cacheable
- Layered System
- Uniform Interface
In SOA 12c we can develop and integrate external REST API’s that supports XML, JSON and URL-encoded GET/POST data support.
Steps to create a REST Service in SOA 12c:
Step 1: Create a new Project in Jdeveloper. Go to File—>New —>Project
Step 2: Select SOA Project and Click Ok.
Step 3: Name the project as per your context and hit finish button.
Step 4: Right click on Components lane and select the component BPEL Process.
Step 5: Give the appropriate name to the BPEL Process and enter following details:
- Template Type: Web Service
- Uncheck Expose as a SOAP Service Radio button
Step 6: BPEL component gets configured.
Step 7: Right Click on the inbound arrow on the bpel and choose the option Expose as REST
Step 8: Name the REST binding as per convention. Click on Next.
Step 9: Configure the Resources. In the Resource Path click on edit button and enter resource name as shown below and click on ok.
Step 10: Click on edit button on Operation Bindings.
Step 11: Select POST as HTTP Verb and XML as payload. Click on ok.
Step 12: Resources and Operation Bindings gets configured. Click finish button.
Step 13: BPEL component gets exposed as REST Service.
Step 14: Double click on the bpel component and add an assign activity after
Step 15: Double click on assign activity and perform mapping between output variable element and input variable element. Click on Apply and Ok.
Step 16: Deploy the project and test it on em console or postman.
So, this is all about the What is REST in SOA 12c and Steps to create REST in SOA 12c .
We cover this in one of the modules of our Oracle SOA Dev where we also cover Develop SOA Composite, Orchestration, Managing and Monitoring Composite Applications, Fault Handling, DVM & MDS, JCA Adapters, Mediator, Business Rule Component and much more interesting and latest features in SOA 12C.
Did You Find this Blog useful?
Leave a Comment.
Some Interesting Topics in SOA Dev:
- [Video] Oracle SOA Suite Development: Meta Data Service (MDS) Click here
- [Video] Oracle SOA Suite Development: Domain Value Map (DVM) Click here
- [Blog]Error Hospital in Oracle SOA Suite 12C Click here
- Enterprise Manager Partition in Oracle SOA Suite 12c/11g Click here
- Subprocess in Oracle SOA Suite 12C Click here
- Templates in SOA 12c Click here
If You’ve not looked at Our Oracle SOA Suite Development Workshop & want to check what we cover in the Workshop then check here & Step By Step Hands-On Activity Guide we cover in Training.
If You’ve not a part of our Oracle SOA Suite Development Workshop & want to check what we cover in the Workshop then check here & Step By Step Hands-On Activity Guide we cover in Training.
Next Task for you:
Want to move ahead in your career and want to get a higher Earning Job?
Get 7+ Courses for DBAs & Apps DBA in a bundle program and learn from the Industry’s best Experts.
Siva Reddy says
I found this blog really informative for implementation of Rest Services in SOA 12c
Alekhya says
Hi Siva,
Thanks for your feedback.
Stay tuned for more blogs on advanced topics of SOA 12c.
Thanks and Regards,
Alekhya
Bharat says
Hi I want to learn REST in SOA can u please let me know
Harshit Yadav says
Hi Bharat,
At K21Academy we offer training where you can learn Oracle SOA Suite 11g/12c https://k21academy.com/soadev03/
For more information, you can mail us your contact information and a suitable time discuss the opportunity on contact@k21academy.com
Thanks and Regards,
Harshit
Nishanth Reddy says
HI Alekya ,
finally i got good blog for Rest but how can i prepare payload for this service.
Thanks in advance
Nishanth Reddy says
HI,
While testing i am facing issue like this
{http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure
faultName: {{http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure}
messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
Surbhi Sharma says
Hi Nishanth,
Please check as this seems to be an issue with mapping in assign or transformation activity
Surbhi
Team K21
CAtherine Gudiwada says
Hey can you pls explain how to solve this same error?
Rahul Dangayach says
Hi Catherine,
This is an error in transformation activity please check and if the issue still persists please contact oracle support for the same.
Regards
Rahul
Ream K21
adrian awadis says
Thanks for sharing this great information I am impressed by the information that you have on this blog. It shows how well you understand this subject.
Rahul Dangayach says
Hi Asrian,
Glad you like the blog.
Please stay tuned for more informative blog.
Thanks and Regards
Rahul Dangayach
Team K21 Academy
Vivek says
Any Idea how to pass Json Input and get Json response from the Rest Web service
Wahed says
Thanks for this…It Successfully deployed the project.
Rahul Dangayach says
Hi Wahed,
Glad you like the blog.
Please stay tuned for more informative blog.
Thanks and Regards
Rahul Dangayach
Team K21 Academy
Marcio Tavares says
I need to call an external REST API from Oracle BPEL, where this API’s service has template parameters on its URL, like: https://server/api/service/{id}
When I call the BPEL service, to call the external API service, I keep getting this error:
“oracle.fabric.common.FabricInvocationException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map”
The service.wadl is configured like this:
…
The Rest Adapter is configured like this:
– Type: Reference
– Base URI: https://server/api
– Resource Path: /service/{id}
– Method:
— Resource: /service/{id}
— HTTP Verb: GET
— URI Parameters:
— Name: id
— Style: template
— Type: string
— Runtime Property: rest.template.id
In the Bpel Process, the Invoke element is configured like this:
‘custom_id’
* I configured the WADL and the Invoke element like recommended in “Doc ID 2261138.1”, at Oracle Support.
What’s the correct method to set a custom id?
Rahul Dangayach says
Hi Marcio,
The error message “oracle.fabric.common.FabricInvocationException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map” suggests that there is an issue with the data type being passed to the REST API.
It seems that the Invoke element is not correctly configured to pass the custom ID as a parameter to the REST API.
To set a custom ID in Oracle BPEL, you can follow the steps outlined in the Oracle BPEL Process Manager Administrator’s Guide:
https://docs.oracle.com/cd/E12483_01/integrate.1013/b28982.pdf
However, this guide does not provide specific instructions for calling an external REST API with template parameters.
Based on the information provided, it seems that the issue may be with the configuration of the Invoke element.
The Invoke element needs to be configured to pass the custom ID as a parameter to the REST API. To do this, you can try the following steps:
1. In the BPEL process, create a variable to hold the custom ID. For example, you can create a variable called “id” of type string.
2. In the Invoke element, set the “Input” property to the variable you created in step 1. For example, set the “Input” property to “id”.
3. In the Invoke element, set the “rest.template.id” runtime property to the variable you created in step 1. For example, set the “rest.template.id” runtime property to “id”.
4. Save and deploy the BPEL process.
5. Test the BPEL process to see if the custom ID is being passed correctly to the REST API.
If the issue persists, you may need to review the configuration of the REST Adapter and the WADL file to ensure that they are correctly configured to handle template parameters.
Hope this helps.
Thanks and Regards
Rahul Dangayach
Team K21Academy