Wednesday, August 8, 2012

How to avoid Selection Failure in Assign activity


One of the queries I got recently was on how to handle selection failures in assign activity if the tags are not present as part of the payload.
To show case how it works I will just do a small sample program which assigns input variable to output variable. I am using PS5(11.1.1.6) environment and BPEL2.0 as specification.
I am using BPEL 2.0 spec, but the solution works in BPEL 1.1 also.
Example:-  I use a simple assign activity to assign 2 elements of input to output.

  <assign name="Assign1" xml:id="id_11">
            <copy xml:id="id_16">
                <from xml:id="id_17">$inputVariable.payload/client:input1</from>
                <to xml:id="id_18">$outputVariable.payload/client:result1</to>
            </copy>
            <copy xml:id="id_19" ignoreMissingFromData="no">
                <from xml:id="id_20">$inputVariable.payload/client:input2</from>
                <to xml:id="id_21">$outputVariable.payload/client:result2</to>
            </copy>
        </assign>


For testing this I pass only one element in payload. The element2 tag is not present in the payload.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bpel="http://xmlns.oracle.com/BPMLearning/Project1/BPELProcess1">
   <soapenv:Header/>
   <soapenv:Body>
      <bpel:process>
         <bpel:input1>hello</bpel:input1>
        </bpel:process>
   </soapenv:Body>
</soapenv:Envelope>



In runtime it throws following selection failure error
Exception stack trace:
Exception is thrown because the from-spec at line 61 is evaluated to be empty
-<details>
-<from-spec>
<from xml:id="id_20" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
$inputVariable.payload/client:input2
</from>
</from-spec>
-<variable>
<message>
inputVariable
</message>
</variable>
-<fault>
-<bpelFault>
<faultType>
0
</faultType>
<selectionFailure xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"/>
</bpelFault>
</fault>
</details>


Solution
 To fix this there is an attribute ignoreMissingFromData
The ignoreMissingFromData attribute suppresses any bpel:selectionFailure standard faults.
BPEL 1.1  syntax
BPEL 2.0 syntax
<copy bpelx:ignoreMissingFromData="yes|no"/>
<copy ignoreMissingFromData="yes|no"/>


 
<assign name="Assign1" xml:id="id_11">
            <copy xml:id="id_16">
                <from xml:id="id_17">$inputVariable.payload/client:input1</from>
                <to xml:id="id_18">$outputVariable.payload/client:result1</to>
            </copy>
            <copy xml:id="id_19" ignoreMissingFromData="yes">
                <from xml:id="id_20">$inputVariable.payload/client:input2</from>
                <to xml:id="id_21">$outputVariable.payload/client:result2</to>
            </copy>
        </assign>

The error gets suppressed since it ignores the element as the ignoreMissingFromData flag is set to yes.
BPEL instance execution stacktrace
Copy rule at line 64 is ignored because the evaluated from value is empty
<payload>

<details>
<from-spec>
<from  xml:id="id_23">$inputVariable.payload/client:input2</from>
</from-spec>
<variable>
<message>inputVariable</message>
</variable>
</details>


















That’s it .It’s an easy solution to selectionFailure instead of
 using the count nodes function and taking headaches in 
doing the mapping.


Monday, June 4, 2012

BPM11g-Getting started with BPMHelloWorld process-issues/workarounds

It has been some time that I got queries on how to get started on BPM .The best way to start on any technology or product stack is to do it the HelloWorld way. Always start with a hello world example.
I am using 11.1.1.1.6 environment for the examples.
There is a good step by step guide of getting started in BPM  @ link
To start up with you can just do the small part of getting the hello message /greeting and writing it to a file . In Jdev it will look like this.
 

The Request Hello in turn is implemented using a Human work flow activity, which receives in a HelloMessage and makes a service call which in turn calls a file adapter to write to a file.
Two activities between Start and End in BPM layer. The implementations of these 2 activities are done in SOA layer using Human work Flow and call to a file adapter.
I will list down some points/issues you may face doing this example
  •       The JDev Role matters, In case you select the BPM Role for Jdeveloper development, the implementation tab will be missing from your activities when you drill down. So if you want to the implementation in SOA then the Role must be default which gives access to both BPM and SOA together.
  •            During your development the main tab that yo will be using is the BPMProjectNavigator which will list the different components that will be part of your process.

  •        There are some chances the auto-create Task form may run into issues. So create the Task form again and delete previous UI project associated with the BPM process. 
  •            Once you compile/deploy BPM process, you will need to login to BPM workspace to view and initiate the process. The common issue is that The BPM process is not visible in th BPM workspace.  The User roles become pretty important in BPM. By default the Role of the Hello world activities will be tied to Role. You can change it to Requester or other role based on your process design.
These roles will now need to be mapped to users.
In case the process doesn’t show up you will have to check or create /modify users for roles.
The below screenshots show the configurations that need to be done on User roles in jdeveloper, EM and BPM workspace.
In jdeveloper
a)    Add the users to the roles used in the process/project.

In Oracle Enterprise Manager
a)    Expand the domain farm  and select  Application Deployments
b)    Select the deployed Application .Go to Security >Application Roles
c)    Add the <project name>.<rolename> and Users to the roles who can access the role.

In oracle BPM workspace
a)    Go to Administration tab >Roles
b)    Add the user to  <composite name>.<role name> members.
  •   In BPM workspace when you click on process to initiate the process for entering the Hello Message. The UI page throws an error .Page not found exception.
Error:  OracleJSP error: java.io.FileNotFoundException: Set the init-param debug_mode to "true" to see the complete exception message.

         The error is because adfc-config.xml refers to Empty1.jspx file.
    Create a empty jspx file and name it as Empty1.jspx , add below content in the file.
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<af:document id="d1">
<af:form id="f1"></af:form>
</af:document>
</f:view>
</jsp:root>
Once you add the file and redeploy the process the error will not recur.
Then you can enter all the hello message and submit the values, which in turn will make a service call to write a message to the file as specified in file adapter.
This is all some points I wanted to share with the newbies starting on BPM 11g
Hav a gr8 day ahead J

Thursday, March 29, 2012

B2B performance issues due to large payloads

My customer was having performance issues while processing big payloads in B2B.  The problem was that the B2B server was hanging whenever a large payload was getting processed at B2B gateway.  The customer wanted a resolution to this problem..
Analysis
-------------------
Whenever Oracle B2B is processing an EDI file, it stores EDI payload and XML file in lob segment in B2B_DATA_STORAGE table. For big files this log segment grows significantly and create b2b runtime problem.The server hangs due to this background process.

Solution
----------------------
Oracle B2B has largepayload support, in which payload will not get persisted in DB.’

Please refer B2B Documentation for more details


Inbound Setup
-----------------
 Large Payload Size is the property that needs to be set for inbound cases. 
Go to Administration > Configuration.

Description of Figure A-1 follows

If a composite is deployed to handle the large payload, this is the only configuration needed. If B2B is not delivering the payload to a composite, set Use JMS Queue as default to true
 Go to Administration > Configuration.

Description of Figure A-2 follows

With Use JMS Queue as default set to true, the payload is delivered to B2B_IN_QUEUE, a JMS-based queue.


Hope this helps

Tuesday, December 6, 2011

SOAP Version Mismatch Exception in SOA 11g


Recently one of the queries that was posted in the practice forum was regarding the SOAP version mismatch

Issue
----------------------------
Facing the below exception in client environment when an external client is invoking bpel service deployed on SOA Suite 11.1.1.4.

oracle.j2ee.ws.saaj.soap.SOAPVersionMismatchException: Mime Header Content-Type: text/xml requires SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/: Mime Header Content-Type: text/xml requires SOAP envelope namespace: http://schemas.xmlsoap.org/soap/envelope/

They tried the option of generating SOAP1.2 binding in the wsdl (i.e., open the wsdl in design mode and drag the ‘binding’ component on to the centre pallete, and choose the option of SOAP 1.2) and the WSDL file will have the namespace like http://schemas.xmlsoap.org/soap12/ which is still different from the namespace client is sending.


1.    When the SOAP 1.2 generated wsdl is opened in browser, only SOAP 1.1 namespace is visible. Is the SOA suite overriding SOAP 1.2 with 1.1? How do we enforce SOA suite to use SOAP1.2 namespace?

Solution
------------------
 The problem is due to version mismatch Client is expecting a SOAP 1.2 service where as we are exposing a SOAP 1.1 service. By default the Jdev created BPEL service will be using SOAP 1.1 .The way to change it is to mention a soap version as part of the service in composite.xml

In composite.xml, add the soap version for the exposed service and redeploy, it will start using SOAP 1.2 bindings. By default if soap version is not specified it uses soap 1.1.

sample code snippet of Composite,xml
---------------------------------------------------------
<service name="bpeltest1_client_ep" ui:wsdlLocation="BPELTest1.wsdl">
  </service>


Hope this helps in resolving the version mismatch issues accessing SCA composite services.