Main | June 2007 »

May 2007 Archives

May 3, 2007

SOAP FAQ

Test

May 7, 2007

Passing BPEL Variable contents into XSLT as Parameters

Here is an interesting solution for passing content of BPEL variables into XSL Transformations as XSL Parameters.

XSL is executed using the XPath Extension Function ora:processXSLT. The two arguments for this extension function are as follows.

1) The XSL File Name
2) The source variable to be transformed [bpws:getVariableData(...)]

But there is one more argument that this XPath function can accept - 'properties'.
Note the signature of this function specified in xpath-functions.xml

Signature:  ora:processXSLT('template','input','properties'?).

These properties translate to XSL Parameters that can be accessed within the XSL Map using the construct
 <xsl:param name="<paramName>"/>

You can retrieve the value of this parameter within your XSLT in a way similar to the way used to extract data from XSL variables.

For e.g.  <Name><xsl:value-of select="$param1"/></Name>

 

 The "properties" argument of the XPath function is expected to be an XML Element that has the following structure.

Illustrated below is an example of such a properties XML.

<parameters xmlns:ns2="http://schemas.oracle.com/service/bpel/common" xmlns="http://schemas.oracle.com/service/bpel/common">
  <ns2:item>
    <ns2:name>userName</ns2:name>
    <ns2:value>ramkmeno</ns2:value>
  </ns2:item>
  <ns2:item>
    <ns2:name>location</ns2:name>
    <ns2:value>CA</ns2:value>
  </ns2:item>
</parameters>

Within the XSLT, the parameters are accessible through their names. [in this case, the parameter names are "userName" and "location", and their values are "ramkmeno" and "CA" respectively.

Approach

1) Declare a variable that is of the abovementioned dataType [see XML above.]
2) Populate the variable with the contents of the BPEL variable you wish to pass into the XSLT
3) Invoke processXSLT() with the XSL File, source variable, and the parameters variable.
4) Access the parameter contents within the XSLT

Example

BPEL Snippet

<!--Step 1: initialize the parameters variable from whatever BPEL variable whose information you need to access from within XSLT -->

<assign name="initializeXSLParameters">
    <bpelx:annotation>
      <bpelx:pattern>transformation</bpelx:pattern>
    </bpelx:annotation>
    <copy>
      <from expression="ora:processXSLT('SetParams.xsl',
                bpws:getVariableData('inputVariable','payload'))"/>
     <to variable="propertiesXMLVar"/>
   </copy>
</assign>

<!--Step 2: Invoke the XSLT with the parameters as the third argument -->

<assign name="executeXSLT">
    <bpelx:annotation>
      <bpelx:pattern>transformation</bpelx:pattern>
    </bpelx:annotation>
    <copy>
       <from expression="ora:processXSLT('TestXSLParams.xsl',
            bpws:getVariableData('inputVariable','payload'),
            bpws:getVariableData('propertiesXMLVar'))"/>
       <to variable="outputVariable" part="payload"/>
   </copy>
</assign>

XSLT Snippet

<xsl:stylesheet version="1.0" ....>

  <xsl:param name="userName"/>
  <xsl:param name="location"/>

  <xsl:template match="/">
    <ns1:TestXSLParamsProcessResponse>
      <ns1:result>
        <xsl:value-of select="concat('User : ', $userName, ' Location : ',$location)"/>
      </ns1:result>
    </ns1:TestXSLParamsProcessResponse>
  </xsl:template>
</xsl:stylesheet>

Output

<TestXSLParamsProcessResponse xmlns:ns1="http://xmlns.oracle.com/TestXSLParams" xmlns="http://xmlns.oracle.com/TestXSLParams">
  <ns1:result>User : ramkmeno Location : CA</ns1:result>
</TestXSLParamsProcessResponse>

May 21, 2007

XSLT 2.0

Just in case you did not know this already -
I was able to execute XSLT 2.0 transformations on ORABPEL 10.1.3.1 runtime.
Even though the graphical modeler does not support this, I could actually design and develop XSLT 2.0 transformation code.
XSLT 2.0 has significant advantages over 1.0 .

Five XSLT 2.0 Features that simplify XML Document transformations -
http://www.oracle.com/technology/pub/articles/wang_xslt.html

Whats new in XSLT 2.0 -
http://www.xml.com/pub/a/2002/04/10/xslt2.html

XSLT 2.0 Specification -
http://www.w3.org/TR/xslt20/

XQuery 1.0 and XPath Functions and Operators -
http://www.w3.org/TR/xpath-functions/

XPath 2.0 Specification -
http://www.w3.org/TR/xpath20/


You need to ensure that the version attribute on your stylesheet element in the XSLT has the value "2.0" to ensure that the XSLT 2.0 processor executes your transformation code.

May 22, 2007

Setting the title of the BPEL Instance

The default title of a BPEL Process Instance that you can see in the BPEL Console is "Instance <instanceId> of <processName>.

You can configure this to include key message data in the Title.

For this, you can use the bpelx:exec within your BPEL Process.

        <bpelx:exec name="setTitle" language="java" version="1.4">
          <![CDATA[
String orderNum = ((String)getVariableData("orderNumber"));  
String woId = ((String)getVariableData("workOrderId"));  
System.err.println("Title is " + (orderNum));  
setTitle("Order [" + orderNum + "][" + woId + "]");]]>
        </bpelx:exec>


When an instance of this BPEL Process is created, the BPEL Console shows the title of the instance in the Console as
Order[1-7654389][1-ABCDEF]

May 23, 2007

Receiving Messages sent through HTTP POST

If a BPEL process invokes a servlet through HTTP POST,


then the servlet can retrieve the request parameters through


request.getReader() or request.getInputStream(). request.getParameter() wont work for parameters posted through HTTP POST.


 


 


 

May 24, 2007

Interesting Article on Web Services Messaging with Axis

I found this interesting article on onjava.com.

http://www.onjava.com/pub/a/onjava/2005/07/27/axis2.html

May 25, 2007

Relevant Links for SOA Suite

May 29, 2007

WSDL 2.0 is in Proposed Recommendation

After nearly 5 years of toil, WSDL 2.0 has reached Proposed Recommendation.
All the document deliverables are available at the WG home page.
http://www.w3.org/2002/ws/desc/

May 30, 2007

Error Management in Oracle AS Adapters

    Here is a technote explaining the Error management features of Oracle AS Adapters.
Click here to access the technote.


These are the questions that the technote answers.

  • What are the different types of Adapter Exceptions?
  • How does the Adapter handle connection errors for the Outbound Interaction case?
  • How does the Adapter handle connection errors for the Inbound Interaction case?
  • How does the Adapter handle data errors (translation errors) for the Outbound Interaction?
  • How does the Adapter handle data errors (translation errors) for the Inbound Interaction?
  • How do I configure the BPEL process to capture Adapter Exceptions?

About May 2007

This page contains all entries posted to Ramkumar Menon's Blog in May 2007. They are listed from oldest to newest.

June 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle