Tuesday, April 14, 2015

Index or paramter passed to XSL not working while using as xpath predicate

Some time we want to pass the index of a node as a parameter to XSL. Inside the xsl we want to use that particular index to get the right node from a complex xml document.

There are many blogs already explaining how we can achieve this.

But there is a small catch in that approach. Here I am trying to explain how we can over come that issue.

As described in other blogs, the steps to pass parameters are as shown below.

1) Defining a parameter.xsd.

Parameter.xsd
----------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://schemas.oracle.com/parameters"
            targetNamespace="http://schemas.oracle.com/parameters"
            elementFormDefault="qualified">
 <xsd:element name="parameters">
    <xsd:complexType>
      <xsd:sequence>    
              <xsd:element name="startIndex" type="xsd:string"/>
              <xsd:element name="endIndex" type="xsd:string"/>
            </xsd:sequence>  
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

2) Define a bpel variable of type parameter

 <variable name="parameters" element="ns3:parameters"/>

Note: Ensure you import the target names space in our BPEL file
 xmlns:ns3="http://schemas.oracle.com/parameters"

3) Initialize the values in the above variable
<assign name="Init">
        <copy>
                <from expression="number(3)"/>
                <to variable="parameters"
                    query="/ns3:parameters/ns3:startIndex"/>
            </copy>
 </assign>

4) Pass the  variable to xsl transform function.

 <from expression="ora:doXSLTransformForDoc('xsl/xForm_CustomerOrder_To_FulfillmentOrder.xsl', $inputVariable.payload, 'parameters', $parameters)"/>

5) Inside the xsl file extract the parameters and use it in the xpath expression to pick the right node.

 <xsl:variable name="startIndex" select="$parameters/ns1:parameters/ns1:startIndex"/>
 <xsl:variable name="endIndex" select="$parameters/ns1:parameters/ns1:endIndex"/>

 Inside the xsl file  if you are using this parameter value as positional search. e.g  CustomerOrder/OrderLine[$startindex]  it will not work


To make it working we need to type cast the above  values to number while assigning to the xsl variable

 <xsl:variable name="startIndex" select="number($parameters/ns1:parameters/ns1:startIndex)"/>
 <xsl:variable name="endIndex" select="number($parameters/ns1:parameters/ns1:endIndex)"/>

Then it will work for positional search. If it is a text based search then this type casting is not required.

How to prevent auto compilation in JDev 12c. How to stop Live Issues Tab popping up

It is very noisy that the auto compilation prevents us modifying the code as the window of Live Issues tab keeps on coming up.

I read in few blogs that this issue can be resolved by setting the SaveAction properties to null in the Jdev->Tools->Preferences



But even after setting this in my JDev the code was getting auto compiled and the Live Issues tab was keeps on coming.

So the simplest way to solve this is to divide your screen. Just drag the Live Issues tab down to your Process tab. In such a way that the Live issues will be shown at the bottom of the page. This will help you to work on the code and watch the issues simultaneously



Tuesday, January 13, 2015

HTTP Request error during 'Submitting Data Send HTTP request': 'Status code - 500'

If you encounter an HTTP 500 error while invoking an OSB service from Siebel, check the Response Flow or Error Flow in the pipeline . See whether you are using a Reply with failure. If so change it to Reply with success

Thursday, December 11, 2014

Reference does not exist as wire target

This error normally comes when we try to comment out some existing references from composite.xml

Normally to disable a particular invocation we comment out the respective reference section in the composite.xml

But at the sametime we need to ensure that

In the composite.xml we comment out the import statement for that reference

Open the .componentType file and comment out the corresponding reference section there as well.

If there is a mismatch between composite.xml and .componentType file, the above error occurs

Monday, December 8, 2014

could not resolve xpath function "getServiceProperty", because missing xpath function meta-data


getServiceProperty method is one of the xpath functions available in aia.jar

If you are getting the above error during project compilation , it means the aia.jar is not attached to your project.

You may get the AIAServiceConstructor using the jdev updates and restart jdev  or explicitly attach aia,jar using the project preferences as shown below


Friday, December 5, 2014

Dynamic PartnerLink in BPEL 2.0

Often we may want to call the target endpoints dynamically. In such cases WS Addressing comes for our help.

In BPEL 1.1 we can assign the following snippet to the partner link and it will try to hit the endpoint mentioned in the snippet.

<wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
    <wsa:Address>http://localhost:8001/soa-infra/services/default/TargetService</wsa:Address>
</wsa:EndpointReference>

But in BPEL 2.0 the above approach was not working for me.

I have achieved the dynamic partner link requirement achieved in BPEL 2.0 as follows

Download the ws-bpel_serviceref.xsd  and add it to your project

Create a variable of element type service-ref , which is defined in the above xsd

<variable name="partnerlink-reference" element="sref:service-ref"/>






For the example purpose I am storing my target endpoint in a variable. (You may use DVM or AIAServiceConfigurationProperty file to store your target endpoint at real time.)

<copy>
        <from>'http://localhost:8001/soa-infra/services/default/TargetService'</from>
        <to>$TargetService</to>
      </copy>


Using append xml fragment option the following xml snippet to the above variable  partnerlink-reference

 <wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
    <wsa:Address/>
</wsa:EndpointReference>

Now enrich the   partnerlink-reference xml with the actual endpoint you need
     <copy>
        <from>$TargetService</from>
        <to>$partnerlink-reference/wsa:EndpointReference/wsa:Address</to>
      </copy>

Finally copy partnerlink-reference variable  to the target partner link

 <copy>
        <from>$partnerlink-reference</from>
        <to partnerLink="TargetServicePartnerLink"/>
      </copy>

The entire Assign activity will look like as follows

<assign name="Assign1">
      <copy>
        <from>'http://localhost:8001/soa-infra/services/default/TargetService'</from>
        <to>$TargetService</to>
      </copy>
      <extensionAssignOperation>
        <bpelx:append>
          <bpelx:from><bpelx:literal><wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
    <wsa:Address/>
</wsa:EndpointReference></bpelx:literal></bpelx:from>
          <bpelx:to>$partnerlink-reference</bpelx:to>
        </bpelx:append>
      </extensionAssignOperation>
      <copy>
        <from>$TargetService</from>
        <to>$partnerlink-reference/wsa:EndpointReference/wsa:Address</to>
      </copy>
      <copy>
        <from>$partnerlink-reference</from>
        <to partnerLink="TargetServicePartnerLink"/>
      </copy>
    </assign>



Save and deploy your project. Test your flow, you can see your partnerlink's target address is changed to the one you updated from your BPELprocess



Tuesday, December 2, 2014

WS Security Error while trying to invoke a BPEL Component

In case of any WS Security error while trying to invoke a BPEL service, verify whether any security policies are attached to that service.

To override the security requirement you can attach the no-authentication policy to the reference exposed to the client . i.e client_ep



This can be done either from emconsole after deployment of the service or in jdev before deploying