[OIC] Expose OIC Integration as SOAP API - Part 1 (Creating SOAP Connection)

 

In this post we will discuss how to expose your OIC Integration as a SOAP API. 

 

Before starting the integration, let's understand SOAP API's. Consider the below SOAP API which has two operations: Add and Substract

WSDL Location: https://ecs.syr.edu/faculty/fawcett/Handouts/cse775/code/calcWebService/Calc.asmx?WSDL

WSDL:

<wsdl:definitions
  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
  xmlns:tns="http://tempuri.org/"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:s="http://www.w3.org/2001/XMLSchema"
  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
 
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Performs simple math over the Web</wsdl:documentation>
 
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:element name="Add">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int"/>
            <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="AddResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="AddResult" type="s:int"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="Subtract">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int"/>
            <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="SubtractResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="SubtractResult" type="s:int"/>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
 
  <wsdl:message name="AddSoapIn">
    <wsdl:part name="parameters" element="tns:Add"/>
  </wsdl:message>
  <wsdl:message name="AddSoapOut">
    <wsdl:part name="parameters" element="tns:AddResponse"/>
  </wsdl:message>
  <wsdl:message name="SubtractSoapIn">
    <wsdl:part name="parameters" element="tns:Subtract"/>
  </wsdl:message>
  <wsdl:message name="SubtractSoapOut">
    <wsdl:part name="parameters" element="tns:SubtractResponse"/>
  </wsdl:message>
 
  <wsdl:portType name="Calculator_x0020_Web_x0020_ServiceSoap">
    <wsdl:operation name="Add">
      <wsdl:documentation
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Computes the sum of two integers
      </wsdl:documentation>
      <wsdl:input message="tns:AddSoapIn"/>
      <wsdl:output message="tns:AddSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="Subtract">
      <wsdl:documentation
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Computes the difference between two integers
      </wsdl:documentation>
      <wsdl:input message="tns:SubtractSoapIn"/>
      <wsdl:output message="tns:SubtractSoapOut"/>
    </wsdl:operation>
  </wsdl:portType>
 
  <wsdl:binding name="Calculator_x0020_Web_x0020_ServiceSoap" type="tns:Calculator_x0020_Web_x0020_ServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="Add">
      <soap:operation soapAction="http://tempuri.org/Add" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Subtract">
      <soap:operation soapAction="http://tempuri.org/Subtract" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
 
  <wsdl:binding name="Calculator_x0020_Web_x0020_ServiceSoap12" type="tns:Calculator_x0020_Web_x0020_ServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="Add">
      <soap12:operation soapAction="http://tempuri.org/Add" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Subtract">
      <soap12:operation soapAction="http://tempuri.org/Subtract" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
 
  <wsdl:service name="Calculator_x0020_Web_x0020_Service">
    <wsdl:documentation
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Performs simple math over the Web
    </wsdl:documentation>
    <wsdl:port name="Calculator_x0020_Web_x0020_ServiceSoap" binding="tns:Calculator_x0020_Web_x0020_ServiceSoap">
      <soap:address location="https://ecs.syr.edu/faculty/fawcett/Handouts/cse775/code/calcWebService/Calc.asmx"/>
    </wsdl:port>
    <wsdl:port name="Calculator_x0020_Web_x0020_ServiceSoap12" binding="tns:Calculator_x0020_Web_x0020_ServiceSoap12">
      <soap12:address location="https://ecs.syr.edu/faculty/fawcett/Handouts/cse775/code/calcWebService/Calc.asmx"/>
    </wsdl:port>
  </wsdl:service>
 
</wsdl:definitions>

 

Key Components of WSDL

 


 

A WSDL document typically consists of the following sections:

  • Types: Defines the data types (XML schema) used by the web service.    
  • Message: Describes the input and output messages that the web service accepts and returns.    
  • PortType: Defines the operations (functions) provided by the service and the messages they exchange.    
  • Binding: Specifies the protocol (SOAP, HTTP, etc.) and data format (like XML) to be used for communication.    
  • Service: Specifies the endpoint (URL) where the web service is available.

To test the above SOAP API, open SOAP UI and provide the WSDL URL and select the checkbox to generate sample request for all operations:

 

 It will create a project with sample request for each operation. Click on Request 1 under Add operation, which is a sample request for Add operation.

 

If you go to Raw view of Request side, you will see that operation to be called is Add operation

 

But, in Request Envelop Add element is name of request element and not the operation name. And this is coming from Message AddSoapIn

 

Since, this is a open SOAP API so there is no need to provide any authentication. Just change the Request Payload and click on Submit Request button to test it:

 

Switch to XML view in response side


 

This is how we will test the SOAP API's. Now to expose OIC Integration as SOAP API, we need only to create a Abstract WSDL, i.e. we need only Types, Message and PortType element

 

Steps to create an abstract WSDL

Consider that we want to have below Request and Response for our SOAP API:

Request:

<Request>
    <FirstName>Gurpreet</FirstName>
    <LastName>Singh</LastName>
</Request>
 
Response: 
<Response>
    <Message>Welcome, Gurpreet Singh</Message>
</Response>
 

Now, first steps is to generate types. So, convert the XML to XSD using online tool https://www.freeformatter.com/xsd-generator.html


<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Request">
    <xs:complexType>
      <xs:sequence>
        <xs:element type="xs:string" name="FirstName"/>
        <xs:element type="xs:string" name="LastName"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Response">
    <xs:complexType>
      <xs:sequence>
        <xs:element type="xs:string" name="Message"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
 

Just tweak this generated XSD and put in Types element, here we have added targetNamespace="http://example.com/SampleSoapService"

<wsdl:types>
    <xs:schema targetNamespace="http://example.com/SampleSoapService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="Request">
            <xs:complexType>
            <xs:sequence>
                <xs:element type="xs:string" name="FirstName"/>
                <xs:element type="xs:string" name="LastName"/>
            </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="Response">
            <xs:complexType>
            <xs:sequence>
                <xs:element type="xs:string" name="Message"/>
            </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>
</wsdl:types>

Now put the Message for this Request and Response as below, (here we have used namespace as tns which we will be defining in root element of WSDL

<wsdl:message name="RequestMessage">
    <wsdl:part name="parameters" element="tns:Request" />
</wsdl:message>
<wsdl:message name="ResponseMessage">
    <wsdl:part name="parameters" element="tns:Response" />
</wsdl:message>
 
Now put the PortType as below 
 
<wsdl:portType name="SampleSoapServicePortType">
    <wsdl:operation name="GetMessage">
        <wsdl:input message="tns:RequestMessage" />
        <wsdl:output message="tns:ResponseMessage" />
    </wsdl:operation>
</wsdl:portType>
 

So, entire Abstract WSDL will be below with Fault Message as well:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema"
                  xmlns:tns="http://example.com/SampleSoapService"
                  name="SampleSoapService"
                  targetNamespace="http://example.com/SampleSoapService">
    <!-- Types -->
    <wsdl:types>
        <xs:schema targetNamespace="http://example.com/SampleSoapService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:element name="Request">
                <xs:complexType>
                <xs:sequence>
                    <xs:element type="xs:string" name="FirstName"/>
                    <xs:element type="xs:string" name="LastName"/>
                </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="Response">
                <xs:complexType>
                <xs:sequence>
                    <xs:element type="xs:string" name="Message"/>
                </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="Fault">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="ErrorMessage" type="xs:string" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>

    <!-- Messages -->
    <wsdl:message name="RequestMessage">
        <wsdl:part name="parameters" element="tns:Request" />
    </wsdl:message>
    <wsdl:message name="ResponseMessage">
        <wsdl:part name="parameters" element="tns:Response" />
    </wsdl:message>
    <wsdl:message name="FaultMessage">
        <wsdl:part name="parameters" element="tns:Fault" />
    </wsdl:message>

    <!-- Port Type -->
    <wsdl:portType name="SampleSoapServicePortType">
        <wsdl:operation name="GetMessage">
            <wsdl:input message="tns:RequestMessage" />
            <wsdl:output message="tns:ResponseMessage" />
            <wsdl:fault name="ServiceFault" message="tns:FaultMessage" />
        </wsdl:operation>
    </wsdl:portType>

</wsdl:definitions>
 
 
Now, save this entire Abstract WSDL in a file like SampleSoapService.wsdl. Please make sure to include each highlighted attributes along with all namespace attributes.
 
 
Steps to create SOAP Connection in OIC
 
  • Open OIC Console and navigate to Design -> Connections
  • Click on Create button and then search for SOAP adapter and select it
 
  •  Enter the Name of the connection and optionally change the other details like Identifier, Keywords, Description.
 
  •  Select the role as Trigger, as we want to use this connection at first point in our integration i.e. exposing integration as SOAP API. Then click on Create button
 
  •  Connection configuration page will appear as below
 
  •  Upload the WSDL File
 
  •  Change the Security policy to Basic Authentication, so that when you will be testing this integration you can user Username and Password of the OIC user to test it
  • Click on Test button and then click on Validate and Test  
 
  •  If WSDL file format is correct Configuration progress will change to 100% 
 
  •  Then click on Save button
 
  •  So now connection is configured and ready to be used in the integrations

Comments

All Categories

Call Fusion BIP Report2 Change Password1 Code Combinations2 Compute Instance2 CTE1 Customer1 Data Aggregation2 Database5 Date Conversion1 DB Adapter2 Decryption1 Development1 EBS4 Encryption1 ESS Jobs3 Examine1 FBDI3 Fusion APIs1 Fusion BIP7 GIT2 GL3 GL Journals1 GL_DAILY_CONVERSION_TYPES1 GL_DAILY_RATES1 ICS1 Identity Domain1 Integrations1 Java1 Journal Import1 Keys1 Legal Entity1 LookupTypeLOV1 LOV1 LOVs1 MultiPartAPIs1 Networking1 NVL2 NVL in OIC2 OCI11 OCI Billing1 OCI Compute5 OCI Cost Management1 OCI Events Service1 OCI Free Tier3 OCI Notifification Service1 OCI Security3 OIC4 OIC Mapper2 Oracle26 Oracle ADF17 Oracle APEX1 Oracle Apps59 Oracle Apps R126 Oracle ATP1 Oracle BIP8 Oracle Cloud12 Oracle Cloud Free Tier1 Oracle cloud Infrastructure9 Oracle Cloud Security2 Oracle Cloud VM1 Oracle DB4 oracle ebs5 Oracle ERP4 Oracle ERP Adapter2 Oracle ERP Cloud7 Oracle financials2 Oracle Forms1 Oracle Fusion57 Oracle Fusion BIP4 Oracle Fusion ERP17 Oracle Fusion Financials18 Oracle Integration Cloud3 Oracle OAF17 Oracle OCI14 Oracle OIC22 Oracle SOA 12c10 Oracle SQL17 Oracle VBCS1 Oracle VBS2 Oracle Visual Builder Cloud Service1 Oracle Visual Builder Studio2 Oracle Workflow Notifications1 Others10 Payables2 Payables Import1 Properties1 R121 Register BIP as ESS Job1 Reset Password1 Responsibility1 REST4 Security List1 Site Map1 SOAP2 SOAP API2 SOAP UI3 SQL16 SQL Functions3 SQL Queries14 SQL Query8 SQL Tips3 SSH1 TCA1 Value Sets1 VBCS1 Virtual Machine2 Virtual Machines1 XML1 XSLT1
Show more