Tuesday, October 1, 2019

12c SOA - Expose Get Rest SOA service and test from browser, SoapUi and PostMaster

Create a XSD to expose rest service. Here i have created a synchronous request-response interaction service.
XSD used:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.cust.abc"
            targetNamespace="http://www.cust.abc" elementFormDefault="qualified">
  <xsd:element name="CustomersReq">
    <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="ID" type="xsd:string"/>
              <xsd:element name="Name" type="xsd:string"/>
              <xsd:element name="Address" type="xsd:string"/>
            </xsd:sequence>
          </xsd:complexType>
  </xsd:element>
   <xsd:element name="CustomersRes">
    <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Outcome" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
Drag a rest adapter in the left exposing swim lane. Provide the Name, Type as Service and checked in the service will invoke components using wsdl interfaces option.
Provide the Description and resource path name and click on the plus sign to add the operation, HTTP verb and other details.
 Provide the resource path name
Provide the operation name, created resource path, HTTP verb as GET and Request and response schema elements.
Request schema element is selected
Response schema element is selected and you can select response payload format as selected  JSON, XML, URL encoded etc.
Create a BPEL and wire them
 In the BPEL, take a assign activity and map


Testing:
Format of the URL for testing:
Take the .wadl file from em console and remove the application.wadl words and add the resource path name.
Here,
WADL:https://hostname:7002/soa-infra/resources/POC/GetRestCustomerProject!1.0/GetCustomerService/application.wadl
Resource path:Cust
so the url will be :
https://hostname:7002/soa-infra/resources/POC/GetRestCustomerProject!1.0/GetCustomerService/Cust

Test from SOAP UI:
Use the above URL and add the request parameters.
Test from Post Master:
Use the above URL and add the request parameters.

Test from Browser appending the request parameters:
http://hostname:8001/soa-infra/resources/POC/GetRestCustomerProject!1.0/GetCustomerService/Cust?ID=123&Name=Name14&Address=asda


No comments:

Post a Comment

Featured Post

OIC - Restrictions on Using Stage File Action Operations with the File/Attachment Features of the Connectivity Agent

Restrictions on Using Stage File Action Operations with the File/Attachment Features of the Connectivity Agent When configuring the stage fi...