Download presentation
Presentation is loading. Please wait.
Published byMelanie Salzmann Modified over 6 years ago
1
Confidential – Oracle Internal/Restricted/Highly Restricted
2
Joe Greenwald Sr. Principal Instructor, Oracle University OOW 2018
Schedule: Timing Topic <xx> minutes Lecture <xx> minutes Practice <xx> minutes Total Expose Enterprise Integration Services as Custom RESTful APIs in 5 minutes Joe Greenwald Sr. Principal Instructor, Oracle University OOW 2018 <Course name>
3
SOA Suite for Enterprise Integration
EM MANAGE MONITOR PATTERN DETECTION CEP BAM BUSINESS VISIBILITY Oracle SOA Suite for complex integrations, orchestrations and process automation Oracle Service bus for high speed routing and transformation JDEV DESIGN SECURE POLICY MANAGER Service Registry and API Manager/CS ORCHESTRATE AUTOMATE BPEL PROCESS MGR BUSINESS RULES HUMAN WORKFLOW INTEGRATE VIRTUALIZE ENTERPRISE SERVICE BUS ERP MAINFRAME SERVICES EVENTS DB PARTNERS Adapters and B2B
4
Moving from SOAP to REST is Quick and Easy
Most companies have many services in SOAP/WSDL New requirements include exposing existing services as REST Must be able to consume REST web services from internal and external sources SOAP/WSDL REST SOAP/WSDL Internal REST REST SOAP/WSDL External REST
5
Supported Features in Oracle SOA Suite
Oracle SOA Suite provides the following REST support: Enabling REST support in new or existing services Declaratively add REST interface to existing SOAP services Integration with external REST APIs Call external REST services with XML or JSON Orchestration of a set of RESTful state transitions Coordinate calls to external REST services Support for XML and JSON Generation of sample URI for REST service operations Support for WADL services Read and generate WADL files Support for REST security with the Oracle Web Service Manager (OWSM) policy Oracle SOA Suite 12c provides the following REST support: It supports exposing an existing SOA SOAP service as a REST service. REST APIs are web APIs that conform to the REST architectural style. REST APIs are basically defined by some web requests (the “methods”) and the data that they return or need, which is usually JSON or XML. REST state transitions occur by following hypermedia (hidden fields, headers, and so on) to reach the next step at which the client is. SOA Suite 12c allows you to model a series of REST state transitions as a business process with a sequence of RESTful invocations. For JSON, SOA Suite 12c supports automatic translation to and from XML. It supports publishing a REST interface either through WADL or WSDL 2.0. WADL files provide an XML description of HTTP- based web applications. It supports attaching OWSM policies to REST binding components, both Service and Reference. Oracle SOA Suite 12c: Build Composite Applications
6
Oracle SOA Suite – 3 Use Cases for Exposing REST Services
Expose an existing SOAP interface as REST Create a custom REST interface from scratch Consume an existing REST Service as an external integration point or consume SOAP service as REST
7
Scenario 1: Expose an Existing SOAP Interface as a REST Interface
The easiest scenario is exposing an existing SOAP interface with a REST interface. Choose the component that implements the interface - mediator or BPEL - and click to Expose as REST. You are simply exposing the same operations supported by the WSDL, but with a REST interface. To generate a REST service based on a SOA component's WSDL service: In the SOA Composite Editor, right-click a SOA component service or an external reference, and select the Expose as REST option. The Create REST Binding dialog is invoked and prepopulated with information from the selected WADL file. Oracle SOA Suite 12c: Build Composite Applications
8
Configure the Adapter If you expose an existing SOAP-based composite, its WSDL and XSD schemas are used to translate incoming payloads into XML. You work with this XML in the same way in the mediator and BPEL - using XPath. Name the Adapter Oracle SOA Suite 12c: Build Composite Applications
9
Defining Resources When exposing an existing SOAP-based composite, the operation(s) exposed in the WSDL are already defined. You define the Resource Path for each operation. You choose what HTTP Verb is called when the service’s operation is invoked. The selected WSDL is read and the WSDL operation is mapped to resource paths and HTTP verbs in the Operation Bindings section. Note that the Resource Path and HTTP Verb sections require additional configuration mapping. In the Resource Path table of the Resources section, double-click the default path entry of /. You can also define the resource path before starting the operation bindings. In this case, the selected resource is used for the new bindings. Oracle SOA Suite 12c: Build Composite Applications
10
Supporting Additional Operations in the REST Interface
In this example, the WSDL was extended to add an additional operation and the Resource Path was renamed. Remember: The REST interface is supporting the same operations as the SOAP interface. Oracle SOA Suite 12c: Build Composite Applications
11
Define Operation Binding
For SOAP-based composites, the schema, request parameters, style, type and expression are inferred from the WSDL. Choose the HTTP Verb for the operation. Schema inferred from the WSDL Operation Displays the WSDL operation name that is being mapped. You can specify the name that is used in the generated WSDL. Resource Select an existing URL resource path from the list or click the Add icon to add a new resource path. The selected resource path is added to the URI Parameters table of the Request section at the bottom of this dialog. If the selected resource contains a template variable, such as {var}, the variable is added to the URI parameters. HTTP Verb Select the verb to be bound to the WSDL operation (for example, GET, PUT, POST, or DELETE). This selection populates the URI Parameters table with mappings from the incoming REST query parameters to the WSDL schema. The HTTP verb for the operation is also added to the Operation Bindings section of the Create REST Binding dialog after clicking OK. Description Enter an optional description. Reference binding components have the Base URI field. Oracle SOA Suite 12c: Build Composite Applications
12
Define the Response Choose what media(s) the payload should be.
You can preview a sample of what the payload will look like. Schema inferred from the WSDL Generate Sample Payloads The HTTP Statuses section enables you to specify the HTTP status code. You can enter multiple statuses, separated by spaces. For a reference, these are the possible statuses that are interpreted as successful. For a service, these are the possible successful statuses that can be returned (as set by a service component such as BPEL). The Payload section enables you to specify the possible response payloads: XML (default), JSON, or no payload. The output returned at runtime depends on the incoming requests. Click Generate Sample Payload to view a sample of the selected response payload. The Schema section displays the response schema being used if a possible payload type has been selected. If no payload has been selected, this field is not displayed. Schema URL: Displays the response schema to use. If you have not specified a schema, you can select to browse for an existing schema or create a new schema from a sample with the Native Format Builder wizard. This wizard enables you to create a schema from a JSON interchange format, XML sample, URI-encoded format, or URI sample. Element: Displays the element to use. The Fault Bindings section displays the response fault name, type, status, and schema. If fault details are defined in the WSDL file, a fault binding is automatically created in this section. You can also manually define fault bindings.by clicking the Add icon. Oracle SOA Suite 12c: Build Composite Applications
13
Testing the New REST Interface
When you test the composite in the Fusion Middleware Control, you will see additional choices, one for each new REST endpoint. You can initiate instances of SOA composite applications that include REST binding components from the Test Instances page in Oracle Enterprise Manager Fusion Middleware Control. This page enables you to test any WSDL or WADL. You can configure properties for REST reference binding components in Oracle Enterprise Manager Fusion Middleware Control. The test page will show the resource path name and choices for the different media types it can receive and return. Oracle SOA Suite 12c: Build Composite Applications
14
Scenario 2: Create a Custom REST Interface
Oracle SOA Suite composite applications can also be exposed as a REST service. Oracle SOA Suite composite applications can consume REST services. The REST adapter can be used to expose and consume REST services. Oracle SOA Suite 12c: Build Composite Applications
15
Scenario 2: Create a Custom REST Exposed Service Interface for a Composite
In this scenario, you are create a custom REST interface to support the Resources and operations your service needs. Follow the same steps as you would for creating any new Exposed Service interface. Drag the REST Adapter to the Exposed Services swimlane. To add a REST service component, right-click the Exposed Services swimlane in the SOA Composite Editor, and select Insert > REST. This action adds REST support as a service binding component to interact with the appropriate service component. Oracle SOA Suite 12c: Build Composite Applications
16
Choose the Composite’s Internal Data Format
Choose if your service will use XML or JSON internally. While using JSON internally within the composite is possible, it is rarely required and the developer must be familiar with JSON and JavaScript to manipulate the variables in the BPEL component. It is easier and simpler to use XML internally. You can still consume and produce JSON if needed. If you will use XML internally, you will have to provide or generate an XSD to define the XML. Starting in , your SOA composites can use end-to-end JSON. This means that the REST service can receive the REST request and route it to the BPEL engine without translating it to XML. The BPEL component can use the JavaScript action, and also use JavaScript in conditional and iterative constructs, to work on JSON objects directly. The REST reference can receive the REST message from the BPEL engine and route it to an external REST endpoint without translation. Note The REST interfaces and BPEL component support end-to-end JSON. However, if you are using other service components, like the Mediator, you need to use the –style composite that internally maps REST resources and verbs to WSDL operations and XML schemas, and translates the incoming payload into XML. Check the box to use XML internally. Leave it unchecked if you are using JSON internally Oracle SOA Suite 12c: Build Composite Applications
17
Configure the Binding You can configure the Resource Path(s), Operations and Parameters manually or use the Configuration Shortcut. If you have a WADL for the REST service, it can be used to pre-configure the binding. You can configure the REST adapter through several shortcuts based on WSDL or WADL files. Configuration Shortcut Provides configuration shortcuts based on the context. For REST Service interfaces: If you are creating a WADL-based REST service, you can choose to Add resources and methods from a WADL service. This enables you to use an existing WADL service to add resources and methods to your REST service. If your service will invoke components using WSDL interfaces, you get options to REST enable a component or service and REST enable external web service. This means that the fault bindings for the selected component or service is automatically generated based on faults defined in the WSDL file. The selected WSDL is read and the WSDL operations are mapped to resource paths and HTTP verbs in the Operation Bindings section of the Resources page. If an operation binding requires additional configuration mapping, this is indicated by the value of no in the Complete column. For REST Reference interfaces: Add resources and operation mappings based on WADL Service enables you to add resources and operation mappings from a WADL resource. The WADL resource can be in your local file system or project, in the design-time Oracle Metadata Services Repository (MDS Repository), or on an application server. Methods This section appears if you are creating a WADL-based service or reference that uses untyped payload without schemas. Click Add to add a new method. You can also select an existing method and click Edit. When you click Add or Edit, the REST Method Definition dialog appears. Oracle SOA Suite 12c: Build Composite Applications
18
Scenario 3: Create a REST External Reference for an External Service
Create REST External References that call REST services by adding a REST adapter to the External References swimlane. These services could be other SOA composites or REST services external to SOA Suite, within your enterprise or outside on the internet. Do you want the data in JSON or XML format inside the composite? Do you have a WADL that describes the service or will you configure the REST binding manually? Follow the same steps as you would for creating any new Exposed Service interface. Drag the REST Adapter to the External References swimlane. To add a REST service component, right-click the Exposed Services swimlane in the SOA Composite Editor, and select Insert > REST. This action adds REST support as a service binding component to interact with the appropriate service component. Oracle SOA Suite 12c: Build Composite Applications
19
Configuring the REST Binding for WSDL and XML
The easiest way to work with data consumed and produced by a REST interface is in XML. But, to do so, you need to have XSDs that describe the request and response data. If you do not have the XSDs, you can create them manually, which is time consuming and error prone. SOA Suite includes the Native Format Builder which will read non-XML data and produce XSDs. These XSDs can be used by the REST interfaces, as well as the other components, like the mediator and BPEL component. The XSDs could also be used to generate WSDL for a SOAP interface if you need to add that to your composite. If you do not have a schema or sample data to generate a schema, you can manually enter the parameters for which to generate a schema. To manually define a schema, click the Add icon, and select Add operation binding in the Operation Bindings section of the Create REST Binding dialog. Note the following guidelines: In the URI Parameters section of the REST Operation Binding page, enter the necessary query or template parameters. You can select a data type for each parameter, but you do not need to enter an expression. If there is no schema and payload specified, when you click OK, the parameter schema is automatically generated (embedded in the WSDL). Parameters that have an expression that is mapped to a runtime property are not included in the generated schema. If there is no schema defined for an operation, the Expression Builder dialog that is accessible from the Expression column only shows property variables and no message variables. Oracle SOA Suite 12c: Build Composite Applications
20
Configuring the REST Adapter Through Shortcuts
The WADL is introspected, the REST service is automatically configured and the new REST Exposed Service is now available to be invoked in the composite. You can configure the REST adapter through several shortcuts based on WSDL or WADL files. To generate a REST service based on a web service deployed on an application server: From the Oracle JDeveloper main menu, select Window > Application Servers. Right-click a WSDL service and select SOA > Expose as REST. You can also generate a REST reference based on a REST service deployed on an application server in a similar fashion. Right click the WADL file and select SOA > Generate REST Reference. You can still customize the Resource Path, and choose the media type(s) the service provides. Oracle SOA Suite 12c: Build Composite Applications
21
Oracle SOA Suite or Service Bus?
Oracle Service Bus is best choice for routing, transformation and integration requirements Easily expose REST Interface for SOAP service Oracle SOA Suite is the best choice if you need: Stateful, long running integrations or process automations Human interactions Business Rules to make dynamic decisions Orchestration over Integration Microservices integrations (all local calls)
22
Questions? joe.greenwald@oracle.com Joe Greenwald
Sr. Principal Instructor, Oracle Corporation
23
Experience Oracle University Learning Subscriptions. Visit education
Experience Oracle University Learning Subscriptions! Visit education.oracle.com/oowtrial Free Trial Subscription: Special invitation from Oracle University to attendees of Oracle OpenWorld or Code One Anytime, anywhere access Continually updated training on Oracle products and technologies. Experience the new Unlimited Product Learning Subscription Instructor notes Details: UPLS Trial: 1 subscription per attendee Ends December 21, 2018 or after attendee consumes 5 hours of learning on the trial subscription. Availability: Go to the education.oracle.com/oowtrial to activate your trial subscription. Oracle Confidential – Internal/Restricted/Highly Restricted
24
Are You Up For the Oracle University Zip Labs Challenge at Code One?
Join us in San Francisco, California at the Moscone West Center where you can compete to win a prize at the “Oracle University Zip Labs Challenge Booth.” When: Monday, October 22th – Open from 9:00am through 4:30pm Tuesday, October 23th – Open from 9:00am through 4:30pm Wednesday, October 24th – Open from 9:00am through 3:00pm What is the Oracle University Zip Labs Challenge? The Oracle University Zip Labs Challenge is a collection of labs, each minute long. Zip Labs guide you through a sequence of steps to accomplish a specific task within the Oracle Cloud Platform. It’s an opportunity to get started experiencing for yourself how some of Oracle’s new technologies work. You can select from labs in the categories covering: Virtual Machines: Creating a VM in OCI Autonomous Data Warehouse (ADW): Provisioning, Connecting to SQL, Machine Learning Autonomous Transaction Processing (ATP): Provisioning, Connecting to SQL, Scaling Great Learning. Great Technology. Great Prizes COME SEE WHAT ALL THE EXCITEMENT IS ABOUT AS YOU WORK THROUGH EXPERT DEVELOPED LABS AND CLIMB HIGHER ON OUR LEADERBOARD THROUGHOUT THE DAY – COMPETING WITH OTHER CONTESTANTS It’s simple to find us. Go to the 2nd floor of Moscone West. As you complete labs and quizzes, you’ll earn points to boost your leaderboard standing. At the end of each day, the top 5 winners win a fabulous prize. So if you are up for the challenge – then we hope you drop by to showcase your skills and curiosity! Looking forward to seeing you there. Confidential – Oracle Internal/Restricted/Highly Restricted
25
Your Chance to Influence Product Direction and Design!
The QR code is DYNAMIC so we can change where it points to if we want. Use the URL code-generator.com/manage/?aftercreate=1 Mary Beth has the account with her gmail. The Cloud Platform UX team would love to get your feedback on new designs. Sign up here:
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.