This tutorial shows you how to REST-enable an existing Simple
Object Access Protocol (SOAP) service from an existing application
by using Oracle SOA Suite 12c.
Time to Complete
Approximately 1 hour
Introduction
Most existing web applications are connected through web
services, which are commonly known as SOAP services. More and more
users are relying on mobile devices for communication, and they’re
looking for lighter ways to access enterprise information on the
go. REST services are the answer for the mobile device platform,
because they get rapid responses and fast access to data.
Oracle SOA Suite 12c provides a complete set of service
infrastructure components for designing, deploying, and managing
composite applications. Oracle SOA Suite 12c enables
services to be created, managed, and orchestrated into composite
applications and business processes.
In this tutorial you, integrate REST operations as
service-binding components and reference-binding components in SOA
composite applications. You REST-enable a service by using an
application that validates credit cards. The application validates
the requested authorization amount for the credit card number, and
it returns the response in XML or JavaScript Object Notation
(JSON) format, the common data formats for mobile devices.
Hardware and Software Requirements
A Windows, Mac OS X, or Linux machine that meets the system
requirements for Oracle SOA Suite 12c.
Note: This tutorial was created with Windows 7.
If you use another operating system, the paths may be different.
Expand ValidatePayment, right-click SOA,
click New, and then select Folder.
If Folder isn’t displayed in the list, then
select From Gallery to find it.
By default the application contains a SOAP proxy service that
checks for a credit card's preset authorized amount. The SOAP
adapter is wired to a Business Process Execution Language (BPEL)
process that pulls the data through a database adapter and
calculates the payment status.
Exposing a REST Service by Using the GET and POST HTTP Methods
In this section, you expose a REST service and then add operation
bindings to the REST service to support GET and POST HTTP methods.
Exposing the Service as REST
In the Components swimlane, right-click
the left wired connection of validatePaymentProcess,
and select Expose as REST.
In this section, you add and wire a mediator to the REST proxy
service and the BPEL process. You also add routing rules to the
mediator to support the GET and POST operations.
Adding and Wiring a Mediator to the REST Proxy Service
Verify that the ValidateRS proxy
service displays the GET and POST operations, and save
your work.
In the Target Services dialog box,
expand BPEL Processes, validatePaymentProcess,
Services, and validatepaymentprocess_client,
select validate, and click OK.
On the PaymentInfo_To_PaymentInfo1.xsl
page, expand ns0:PaymentInfo in the <sources>
and xsl:stylesheet panes, map the leaf
nodes manually as follows, and then save and close the
page:
ns0:CardNum to ns0:CardNum
ns0:ExpireDate to
ns0:ExpireDate
ns0:AuthorizationAmount to
ns0:AuthorizationAmount
On the PaymentStatus_To_PaymentStatus1.xsl
page, expand ns0:PaymentStatus in both
sides in the <sources> and xsl:stylesheet
panes, map the ns0:Status leaf nodes
manually, and then save and close the page:
In the Target Services dialog box,
expand BPEL Processes, validatePaymentProcess,
Services, and validatepaymentprocess_client,
select validate, and click OK.
On the PaymentInfo_To_PaymentInfo2.xsl
page, expand ns0:PaymentInfo in the <sources>
and xsl:stylesheet panes, map the leaf
nodes manually as follows, and then save and close the
page:
ns0:CardNum to ns0:CardNum
ns0:ExpireDate to
ns0:ExpireDate
ns0:AuthorizationAmount to
ns0:AuthorizationAmount
On the PaymentStatus_To_PaymentStatus2.xsl
page, expand ns0:PaymentStatus in both
sides in the <sources> and xsl:stylesheet
panes, map the ns0:Status leaf nodes
manually, and then save and close the page:
On the Deploy ValidatePayment page, enter,
select, or verify the following values on the specified pages,
click Next on each page, and then click Finish
on the Summary page after you review your
selections:
Deployment Action page: Select Deploy
to Application Server.
Deploy Configuration page: Enter or
verify 1.0 for the New revision ID
field, and select Overwrite any existing composites
with the same revision ID.
Select Server page: Select IntegratedWebLogicServer.
SOA Servers page: Verify that the default
server is running and selected.
In your Internet Explorer, Firefox, or Chrome browser, open
Oracle Enterprise Manager. In the Login
dialog box, enter the following values and then click Login:
In the Target Navigation pane, expand SOA,soa-infra(DefaultServer),
and default, and select ValidatePayment[1.0].
In the right pane, click Test and select ValidateRS.
With Oracle SOA Suite 12c, you can expose REST services
to support integration of data with mobile devices.
You enable the REST exposure by using a REST adapter wired to a
mediator. The mediator translates and maps the input and output
between the REST adapter and the BPEL process.
To support the GET and POST HTTP methods, you added operations to
the REST service. The same service is available through the GET
and POST requests.
In this tutorial, you learned to:
Expose a REST service by using the GET and POST HTTP methods
in Oracle SOA Suite 12c
Wire a REST adapter to a BPEL process through a mediator
Deploy a composite application to Oracle WebLogic Server
Test a REST service by using Oracle Enterprise Manager