Monday, February 24, 2020

12c SOA - DVM - lookup multiple domain values

Here I will show you how to get multiple domain values from a DVM using dvm:lookupValue1M() function.

Implementation steps:
Create a SOA Project


 Select Empty composite
 Create the contract schema which is used for exposing the client.



 <?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.citydetails.poc"
            targetNamespace="http://www.citydetails.poc" elementFormDefault="qualified">
  <xsd:element name="clientRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="cityName" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="clientResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="cityName" type="xsd:string"/>
        <xsd:element name="cityCode" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="capital" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema> 

Create WSDL based on this schema.



 Take a BPEL Process and select based on wsdl template and choose the created the wsdl.




 Create a City DVM



 In the BPEL, Drag and drop Transformation activity and use dvm:lookupValue1M() function to get multiple values and store them in a variable and then use the variable in fields mapping.

We use dvm:lookupValue and dvm:lookupValue1M XPath functions to look up a domain value map for a single value or multiple values at runtime from DVM tables. Here I have used the dvm:lookupValue1M Xpath function in XSL to get the city detail by passing CityName as a KeyColumn to lookup dvm table.

XSLT:
 <?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator" xmlns:oracle-xsl-mapper="http://www.oracle.com/xsl/mapper/schemas" xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue" xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction" xmlns:oraxsl="http://www.oracle.com/XSL/Transform/java" xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://www.citydetails.poc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions" exclude-result-prefixes=" oracle-xsl-mapper xsi xsd xsl ns0 socket dvm mhdr oraxsl oraext xp20 xref"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                xmlns:tns="http://xmlns.oracle.com/SOAApplication/DVM1ToManyProject/cityDetails">
   <oracle-xsl-mapper:schema>
      <!--SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY.-->
      <oracle-xsl-mapper:mapSources>
         <oracle-xsl-mapper:source type="WSDL">
            <oracle-xsl-mapper:schema location="../WSDLs/cityDetails.wsdl"/>
            <oracle-xsl-mapper:rootElement name="clientRequest" namespace="http://www.citydetails.poc"/>
         </oracle-xsl-mapper:source>
      </oracle-xsl-mapper:mapSources>
      <oracle-xsl-mapper:mapTargets>
         <oracle-xsl-mapper:target type="WSDL">
            <oracle-xsl-mapper:schema location="../WSDLs/cityDetails.wsdl"/>
            <oracle-xsl-mapper:rootElement name="clientResponse" namespace="http://www.citydetails.poc"/>
         </oracle-xsl-mapper:target>
      </oracle-xsl-mapper:mapTargets>
      <!--GENERATED BY ORACLE XSL MAPPER 12.2.1.0.0(XSLT Build 151013.0700.0085) AT [MON FEB 17 13:56:32 IST 2020].-->
   </oracle-xsl-mapper:schema>
   <!--User Editing allowed BELOW this line - DO NOT DELETE THIS LINE-->
    <xsl:variable name="CityDetails"
   select="dvm:lookupValue1M('DVM/CityDetails.dvm','CityName',/ns0:clientRequest/ns0:cityName,'CityCode','State','Capital')"/>
   <xsl:template match="/">
      <ns0:clientResponse>
         <ns0:cityName>
            <xsl:value-of select="/ns0:clientRequest/ns0:cityName"/>
         </ns0:cityName>
         <ns0:cityCode>
            <xsl:value-of select="$CityDetails/CityCode"/>
         </ns0:cityCode>
         <ns0:state>
            <xsl:value-of select="$CityDetails/State"/>
         </ns0:state>
         <ns0:capital>
            <xsl:value-of select="$CityDetails/Capital"/>
         </ns0:capital>
      </ns0:clientResponse>
     
   </xsl:template>
</xsl:stylesheet>
 Deploy and test


Wednesday, February 19, 2020

12c SOA - Weblogic - how to modify datasource connection and resume the suspended datasource services

Implementation steps:
Go the Admin console⇾Domain⇾Services⇾Data Sources
 Click on the data-source to be modified.
 Go to the Connection pool tab

Take the lock and update the connection

Update done. Restart the impacted manage servers.(Domain⇾Environment⇾Servers⇾Control tab)
Go to Monitoring tab⇾Testing and test the data source on servers.
If any server is suspended then go to the control tab and resume the suspended servers.
Yes
The data source instances are resumed.
Go back to monitoring tab⇾testing and test all the data-source instances.

Friday, February 14, 2020

12c SOA - Adding Weblogic Server in IDE or Application server in Jdeveloper

Go to File⇾New⇾From Gallery and navigate to General⇾Connections. Select Application Server Connection and click OK.

 Enter Connection Name and select appropriate Connection Type as shown below.
 Click Next and give valid credentials.
 Click Next and give the server details and Weblogic Domain as shown below.
 Click Next and do Test Connection.

Click Finish and verify navigating to Window⇾Application Servers.

Thursday, February 13, 2020

12c SOA - WS Security - expose service with header and WSSE user token authentication

  • WS-Security is a specification published by OASIS, it is mainly aimed for SOAP Web Services. It encompasses a number of mechanisms to strengthen the integrity and confidentiality of the messages exchanged between these type of services such as data encryption, security tokens, username and password validation, signed messages, etc.
  • On the other hand, Oracle Web Service Manager (OWSM) is a component of Oracle SOA Suite that provides a framework for centralizing policy management and security of Web Services. OWSM is based on the WS-Policy standard and can be used in development time, or from the management console.
  • For the SOAP Service the username and password will travel in the UsernameToken element embedded within the SOAP Envelope message Header, and for the REST service, it will travel in the HTTP transport Header.
Here you will find how to configure from a development perspective using JDeveloper, a policy-based user and password authentication for a SOAP.

Implementation:

Step1: Create a Schema:
XSD:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emp.test"
            targetNamespace="http://www.emp.test" elementFormDefault="qualified">
    <xsd:element name="EmployeeRequest">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="EmpId" type="xsd:string"/>
                <xsd:element name="EmpName" type="xsd:string"/>
                <xsd:element name="Address" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
        <xsd:element name="EmployeeResponse">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="result" type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="requestHeader">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="User" type="xsd:string" minOccurs="0"/>
            <xsd:element name="Id" type="xsd:string" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
</xsd:schema>

Step2: Create a WSDL:
Right click on project folder WSDLs⇾New⇾From Galary⇾All Items⇾WSDL(builder)(Interfaces)⇾OK⇾Provide Service Name,Port type, operation and choose Interface Type as Synchronous and Add the message part(Request and Header) in the Input and Response in the Output sections.

<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions name="service1"
                  targetNamespace="http://xmlns.oracle.com/SOAApplication/ExposeHeaderWithWSSProject/service1"
                  xmlns:tns="http://xmlns.oracle.com/SOAApplication/ExposeHeaderWithWSSProject/service1"
                  xmlns:inp1="http://www.emp.test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsd:import namespace="http://www.emp.test" schemaLocation="../Schemas/EMP.xsd"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="requestMessage">
        <wsdl:part name="requestHeader" element="inp1:requestHeader"/>
        <wsdl:part name="paylod" element="inp1:EmployeeRequest"/>
    </wsdl:message>
    <wsdl:message name="replyMessage">
        <wsdl:part name="payload" element="inp1:EmployeeResponse"/>
    </wsdl:message>
    <wsdl:portType name="execute_ptt">
        <wsdl:operation name="execute">
            <wsdl:input message="tns:requestMessage"/>
            <wsdl:output message="tns:replyMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="execute_pttSOAP11Binding" type="tns:execute_ptt">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="execute">
            <soap:operation style="document"
                            soapAction="http://xmlns.oracle.com/SOAApplication/ExposeHeaderWithWSSProject/service1/execute"/>
            <wsdl:input>
                <soap:body use="literal" parts="paylod"/>
                <soap:header message="tns:requestMessage" use="literal" part="requestHeader"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" parts="payload"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
</wsdl:definitions>

Step3: Create a BPEL service based on the above WSDL:






Step4: Configure SOA WS Policies...




Step5: Deploy and take the wsdl and test from SOAP UI:

Test1: Tested without WSSE Security user token authentication:
 Test2: Tested with WSSE Security user token authentication:
Payload with WSSE:
<soapenv:Envelope xmlns:emp="http://www.emp.test" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-81CB99D5C318DB117215815725859457">
            <wsse:Username>wsstest</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">wsstest1</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">j05VdqxZ2sVIdPjZiGKi5Q==</wsse:Nonce>
            <wsu:Created>2020-02-13T05:43:05.944Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
      <emp:requestHeader>
         <!--Optional:-->
         <emp:User>user1</emp:User>
         <!--Optional:-->
         <emp:Id>id1</emp:Id>
      </emp:requestHeader>
   </soapenv:Header>
   <soapenv:Body>
      <emp:EmployeeRequest>
         <emp:EmpId>e1</emp:EmpId>
         <emp:EmpName>enmae</emp:EmpName>
         <emp:Address>eadd</emp:Address>
      </emp:EmployeeRequest>
   </soapenv:Body>
</soapenv:Envelope>

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