Monday, January 27, 2020

12c SOA BPEL - Error - "fromValue is not a sref:service-ref element"

Problem Description:
In BPEL 1.1, We can achieve the dynamic partnerlink using simple ws-addressing but In BPEL 2.0, its not that simple. If we want to do with only ws-addressing, it will throw the following error:

<selectionFailure xmlns=”h ttp://docs.oasis-open.org/wsbpel/2.0/process/executable”>
<part name=”summary”>
<summary>fromValue is not a sref:service-ref element</summary>
</part>

Solution:
We can achieve the dynamic partnerlink in BPEL 2.0 without the error. For that we have to use EndpointReference element of ws-addressing.xsd and service-ref element of ws-bpel_serviceref.xsd.

Please visit here 12c-soa-bpel-20-dynamic-partner-link for the dynamic partnerlink implementation steps using EndpointReference element of ws-addressing.xsd and service-ref element of ws-bpel_serviceref.xsd.

12c SOA - BPEL 2.0 - Dynamic Partner link

The dynamic partnerlink feature enables us to dynamically assign an endpoint reference to a partnerlink for use at runtime in BPEL versions 1.1 and 2.0.

Scenario where we can use :
Let suppose there is a requirement to design process for which the end point is not fixed i.e. there are multiple end points that can be used. In an ideal scenario a developer will define multiple partnerlink and will write separate logic to use them. This will un necessarily complicate the code. This can be simplified using a single dynamic partnerlink. In order to achieve this we will first create the required number of web services (end point URL) based on same wsdl. These will be a simple web services which will accept the input, will do some enhancement and will return it back to the calling service. Next is we will define another process where in we will define a dynamic partnerlink to call these end point url based on input. In order to achieve this a variable will be created based on ws-addressing Endpoint-reference (more detail on the implementation). This variable will serve as an input to the dynamic partnerlink for deciding on which web service has to be called. Based on the input this variable will be updated with the end point url of the predefined web services and the services will be called dynamically.

In BPEL 1.1, We can achieve the dynamic partnerlink using simple ws-addressing but In BPEL 2.0, its not that simple. If you want to do with only ws-addressing, it will throw the following error:
"fromValue is not a sref:service-ref element"

Implementation steps:
  • First create a VersionProject and deploy the project with 3 versions 1.0, 2.0 and 3.0. 
  • Then create Dynamicpartnerlick project where it will take inputs Msg and Url.
  • It will invoke the version project version 1.0 only. 
  • Then create following 3 variables 
  1. variable varURL based on Project Input Url schema.
  2. variable varAddress1 based on EndpointReference element of ws-addressing.xsd 
  3. variable serviceRef based on service-ref element of ws-bpel_serviceref.xsd
  • Next, following 3 assigns and 1 Transformation:
  1. Msg assigned to Input of invoked service
  2. input Url assigned to $varURL/client:url
  3. Transformation varURL to serviceRef (Structured defined later)
  4. serviceRef  assigned to VeresionProject partner link.
Implementation with BPEL 2.0:

Create synchronous VersionProject.






 Created Service WSDLs:
http://localhost:8001/soa-infra/services/POC/VersionProject!1.0*soa_a685a792-9a15-4d82-9e95-956c3e2e5b1d/versionprocess_client_ep?WSDL
 http://localhost:8001/soa-infra/services/POC/VersionProject!2.0*soa_a685a792-9a15-4d82-9e95-956c3e2e5b1d/versionprocess_client_ep?WSDL
 http://localhost:8001/soa-infra/services/POC/VersionProject!3.0*soa_a685a792-9a15-4d82-9e95-956c3e2e5b1d/versionprocess_client_ep?WSDL

Create synchronous DynamicPartnerlinkProject


 Modify the XSD as below
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/SOAApplication/DynamicPartnerLinkProject/DynamicClientProcess"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="process">
<complexType>
<sequence>
<element name="msg" type="string"/>
                                <element name="url" type="string"/>
</sequence>
</complexType>
</element>
<element name="processResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
</schema>
 Invoke the SOAP service - Version project v1.0 WSDL.


 Open the BPEL
 Create the mentioned 3 variables.


 Assigns the Msg and Url.
 Transform the Url to serviceref using ws-addressing.
  <xsl:template match="/">
    <tns:service-ref>
      <EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <Address>
          <xsl:value-of select="/ns0:process/ns0:url"/>
        </Address>
      </EndpointReference>
    </tns:service-ref>
  </xsl:template>

 Assign the service-ref variable to VersionProject Partnerlink
 Invoke the Version Project Service
 Assign the Result output
 The flow will look like
 Deploy and test with the Url inputs.

Tested with v1.0

 Tested with 2.0

Tested with 3.0


Wednesday, January 22, 2020

12c SOA - BPEL pick activity OnAlarm

Logic:
  • It works like if the response does not come in the time period defined in alarm then it start executing the flow in the onAlarm scope.
  • If the result comes before the expiration of onAlram then onMessage scope is followed.
Implementation steps:
Create a To be picked project.



 Create the Picker project which will call the "To be picked" project.

 Calling the "To be Picked" project


 Invoke the new parterlink and assign.

 Drag and drop a Pick activity


 Provide 2 assign.

 Adding 10 sec OnAlarm
 Adding onMassge using "To be picked" parterlink.

 Deploy and test.

It will invoke the OnMessage.
 Now add a wait activity of 11 sec in "To be Picked" project and test
 This time OnAlarm is invoked.
As we added the 11 sec wait in "To be Picked" project which is greater than the trigger time (10 sec) configured in the onAlarm. Thus this triggers the onAlarm flow.


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