Tuesday, October 1, 2019

12c SOA - Expose Post Rest SOA service using REST adapter and test from 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="Customer" maxOccurs="unbounded">
          <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: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 operation name, created resource path, HTTP verb as POST 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 map the response.
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://uadcc-elmweb02:7002/soa-infra/resources/POC/LoopInBPELProject!1.0/RestService/application.wadl
Resource path:abc
so the url will be :

https://uadcc-elmweb02:7002/soa-infra/resources/POC/LoopInBPELProject!1.0/RestService/abc

Test from SOAP UI:
Payload:
<CustomersReq xmlns="http://www.cust.abc">
   <Customer>
      <ID>ID10</ID>
      <Name>Name11</Name>
      <Address>Address12</Address>
   </Customer>

</CustomersReq>

 Test from Post Master:

No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...