Monday, February 10, 2020

12c SOA - BPEL - expose service with headers

Here I will show you how to expose a BPEL(Synchronous)  service with header.

Create a SOA Project

 Create an XSD

 XSD Create: for Request - response with header:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="" xmlns="http://www.emp.test"
            targetNamespace="http://www.emp.test" elementFormDefault="qualified">
    <xsd:element name="Request">
                <xsd:element name="EmpId" type="xsd:string"/>
                <xsd:element name="EmpName" type="xsd:string"/>
                <xsd:element name="Address" type="xsd:string"/>
        <xsd:element name="Response">
                <xsd:element name="result" type="xsd:string"/>
    <xsd:element name="header" type="tRequestHeader"/>
    <xsd:complexType name="tRequestHeader">
            <xsd:element name="User" type="xsd:string" minOccurs="0"/>
            <xsd:element name="Id" type="xsd:string" minOccurs="0"/>

 Create BPEL
 Choose template based on WSDL and generate wsdl from schema.
 Create WSDL: Input will have Header and Request and Output will have Response part.
 Adding header

 Add the Request payload same above way

 Add the Response part.

 BPEL is exposed
 In the BPEL, assign one Header to output result variable.

 Now open the created WSDL and add binding

 The WSDL should look like this.
<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions name="BPELProcess1"
                  xmlns:inp1="http://www.emp.test" xmlns:plnk=""
                  xmlns:wsdl="" xmlns:soap="">
    <plnk:partnerLinkType name="BPELProcess1">
        <plnk:role name="BPELProcess1Provider" portType="tns:execute_ptt"/>
        <xsd:schema xmlns:xsd="">
            <xsd:import namespace="http://www.emp.test" schemaLocation="../Schemas/EMPloyee.xsd"/>
    <wsdl:message name="requestMessage">
        <wsdl:part name="header" element="inp1:header"/>
        <wsdl:part name="payload" element="inp1:Request"/>
    <wsdl:message name="replyMessage">
        <wsdl:part name="payload" element="inp1:Response"/>
    <wsdl:portType name="execute_ptt">
        <wsdl:operation name="execute">
            <wsdl:input message="tns:requestMessage"/>
            <wsdl:output message="tns:replyMessage"/>
    <wsdl:binding name="execute_pttSOAP11Binding" type="tns:execute_ptt">
        <soap:binding style="document" transport=""/>
        <wsdl:operation name="execute">
            <soap:operation style="document"
               <soap:header message="tns:requestMessage" use="literal" part="header"/>
                <soap:body use="literal" parts="payload"/>
                <soap:body use="literal" parts="payload"/>

 Deploy and take the wsdl and test from soap ui
 See 2 parts created one for Input and another for header.
Note: with Oneway /Async BPEL service, you can't expose the service with headers.

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