Monday, May 26, 2014

Set & Send SOAP Headers in BPEL

Recently, I am supposed to call a external web service and it require few values in SOAP header to validate the request message. I did following changes in my BPEL process to set & send SOAP headers in request message.

Request Message Format:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
<ns2:UsernameToken xmlns:ns2="http://siebel.com">LK@XYZ.COM</ns2:UsernameToken>
<ns3:PasswordText xmlns:ns3="http://siebel.com">Test123</ns3:PasswordText>
   </soapenv:Header>
   <soapenv:Body>
      <..........................SOAP BODY..............>
   </soapenv:Body>
</soapenv:Envelope>

I followed below steps to set these headers in BPEL.

  • Created a XSD having required headers as elements in schema. For ex:

            <?xml version="1.0" encoding="UTF-8" ?>
           <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                               xmlns:ns2="http://siebel.com"
                               targetNamespace="http://siebel.com"
                               elementFormDefault="qualified">
              <xsd:element name="UsernameToken" type="xsd:string"/>
              <xsd:element name="PasswordText" type="xsd:string"/>
           </xsd:schema>

  • In BPEL process created a two variables based on above schema to hold header values.

           <variable name="UsernameToken" element="ns2:UsernameToken"/>
           <variable name="PasswordText" element="ns2:PasswordText"/>

  • Assigned values for these variables using assign activity.

         <assign name="AssignInput">
            <copy>
                <from expression="'LK@XYZ.COM'"/>
                <to variable="UsernameToken" query="/ns2:UsernameToken"/>
           </copy>
           <copy>
               <from expression="'Test123'"/>
               <to variable="PasswordText" query="/ns2:PasswordText"/>
             </copy>
          </assign>

  • Set these variables as Headers in Invoke activity. The Invoke activity looks as below, after adding headers.

          <invoke name="InvokeWS"
            inputVariable="WS_InputVariable"
            outputVariable="WS_OutputVariable" partnerLink="TestWebService"
            portType="ns1:AutoRequest" operation="process"
            bpelx:invokeAsDetail="no"
            bpelx:inputHeaderVariable="UsernameToken,PasswordText"/>


Saturday, May 24, 2014

JDeveloper 11.1.1.7.0 - View Object Possible Bug

Build JDEVADF_11.1.1.7.0_GENERIC_130226.1400.6493

Recently I tried to add a new transient attribute to existing view object based on entity object. While doing that, I figured out that, by default the view object setting attribute type as 'String' even though I selected type as Boolean. Of course, we can change the attribute type as required by editing the attribute. But, I am sharing this just for a note.

Select view object and click on New attribute to open new attribute window. Select type as Boolean and updatable property as Always. Click on Ok.

But the attribute type set as String

Select attribute and click on Edit sign to edit attribute. You will find updatable property also set as Never.

InvalidOperException: JBO-25221


I created a method (that has a typed list parameter for ex: List<ObjectType>) in Application Module class and exposed to view layer through client interface. Add exposed method from AM class using method Action binding in page definition file. And when I tried to execute this operation binding during run time, some times I got below error message in log files and some times not, but method did not get executed in either cases.

Created AM Method:
--------------------------
    public String insertEmpDetails(ArrayList<empObj> empDetailsList) {
       //business logic
   }
 
Operation Binding in Page definition file:
---------------------------------------------------
    <methodAction id="insertEmpDetails"
                  InstanceName="HRDBAppModuleDataControl.dataProvider"
                  DataControl="HRDBAppModuleDataControl"
                  RequiresUpdateModel="true" Action="invokeMethod"
                  MethodName="insertEmpDetails" IsViewObjectMethod="false"
                  ReturnName="data.HRDBAppModuleDataControl.methodResults.insertEmpDetails_HRDBAppModuleDataControl_dataProvider_insertEmpDetails_result">
      <NamedData NDName="empDetailsList"
                 NDType="java.util.ArrayList&lt;com.oracle.types.empObj>"/>
    </methodAction>

Warning in Log file:
------------------------
[2014-05-20T19:03:57.827+05:30] [AdminServer] [WARNING] [] [oracle.adf.controller.faces.lifecycle.Utils] [tid: [ACTIVE].ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: e9d0884f97c30d1a:-5af6bfa2:1461863bfa1:-8000-0000000000000562,0] [APP: DecomApp] [DSID: 0000KOPpMe_33FLaEPf9ES1JUjfG00000I] ADF: Adding the following JSF error message: Method HRDBAppModuleDataControl.dataProvider.insertEmpDetails() not supported[[
oracle.jbo.InvalidOperException: JBO-25221: Method HRDBAppModuleDataControl.dataProvider.insertEmpDetails() not supported
    at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:581)
    at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:2143)
    at oracle.adf.model.bc4j.DCJboDataControl.invokeMethod(DCJboDataControl.java:3118)
    at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:261)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1635)
    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)
    at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:407)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
    at com.oracle.empBean.submitReq(empBean.java:889)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


After multiple trails, I found problem in page definition and changed NDType as shown below. This time, it worked properly.

Updated Page Definition file:
------------------------------------
    <methodAction id="insertEmpDetails"
                  InstanceName="HRDBAppModuleDataControl.dataProvider"
                  DataControl="HRDBAppModuleDataControl"
                  RequiresUpdateModel="true" Action="invokeMethod"
                  MethodName="insertEmpDetails" IsViewObjectMethod="false"
                  ReturnName="data.HRDBAppModuleDataControl.methodResults.insertEmpDetails_HRDBAppModuleDataControl_dataProvider_insertEmpDetails_result">
      <NamedData NDName="empDetailsList"
                 NDType="java.util.ArrayList"/>
    </methodAction>

Not sure, what's causing the problem. I found this workaround to solve my problem.