Thursday, October 3, 2019

12c OSB - Create get rest OSB service using rest adapter

Create a service bus project.


 Create a REST adapter on left swim lane

 Provide the Resource path name
 Provide the get operation and request and response schema element details.



 Now drag a pipeline and choose the created wsdl file

De-select the expose as a proxy service

Open the pipeline and add a stage it it

Provide the xpath which to be sent as a response.

Rest URI:
http://hostname:2001/GetCustomerRestSBProject/RestService/cust
Format:
http://localhost:<<OSB Port>/<<proxy endpoint>>/<<resource name>>

Open in soap ui

 test:

12c SOA - Invoke Post Rest SOA service from another SOA composite using REST adapter

Here i will show you how to invoke post rest soa service from another SOA composite using REST adapter.In my previous post, i have created the following expose post rest service. In this blog, i will use this service WADL.
Service WADL:
https://hostname:8001/soa-infra/resources/POC/LoopInBPELProject!1.0/RestService/application.wadl

Implementation:
Create XSD for the synchronous BPEL process
XSD:
<?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 external references swim lane and provide Name, Type as Reference and checked the Reference will be invoked by components using WSDL interface option
  Click on Configuration shortcut plus sign to add the wadl service.
  Put the WADL in the selection and press enter key
 It has parsed the WADL and fetched all the required resource path and operation details.
 Check for Localize external references.
 Rest adapter is ready. wire the components.
 In the BPEL, Assign the input and output to/from to rest adpater.
 Test from EM console.



12c SOA - Invoke get rest soa service from SOA composite using REST adapter

Here i will show you how to invoke get rest soa service from another SOA composite using REST adapter.In my previous post, i have created the following expose get rest service. In this blog, i will use this service WADL.
Service WADL:
http://hostname:8001/soa-infra/resources/POC/GetRestCustomerProject!1.0/GetCustomerService/application.wadl
Implementation:
Drag a rest adapter in the external references swim lane and provide Name, Type as Reference and checked the Reference will be invoked by components using WSDL interface option
 Click on Configuration shortcut plus sign to add the wadl service.
 Put the WADL in the selection and press enter key
 Parsing WADL
 It has parsed the WADL and fetched all the required resource path and operation details.
 Check for Localize external references.
 Rest adpater is ready to be invoked.
 Create a Synchronous BPEL
 Wire the rest adapter
 In the BPEL, Assign the input and output to/from to rest adpater.
 Test from em console.


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:

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


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...