CodeGuru
Earthweb Search
Forums Wireless Jars Gamelan Developer.com
CodeGuru Navigation
Member Sign In
User ID:
Password:
Remember Me:
Forgot Password?
Not a member?
Click here for more information and to register.

Become a Marketplace Partner

jobs.internet.com

internet.commerce
Partners & Affiliates
















RSS Feeds

RSSAll

RSSVC++/C++

RSS.NET/C#

RSSVB

See more EarthWeb Network feeds

Home >> Visual C++ / C++ >> Sample Chapter


Oracle BPEL Process Manager
Rating:

Packt Publishing (view profile)
October 19, 2005

Go to page: Prev  1  2  3  4  5  6  7  8  9  10  11  12  13  Next

Building and Deploying

BPEL Designer offers direct compilation and deployment on the Oracle BPEL Server. This can be done from the toolbar or from the BPEL menu. In addition to building and deploying, we can also validate our project and open the BPEL Console:


(continued)



For more information about the BPEL Designer refer to Oracle documentation. In the next section we look at the Oracle-specific functions of the BPEL Process Manager. We will start with the Oracle-specific extension functions.

Oracle-Specific Functions

In Chapters 2 and 3 we saw that BPEL is very flexible with respect to the expression and query language. By default we use XPath 1.0; however, we can use any other language supported by the BPEL server. The idea behind this flexibility has been to open up BPEL for future versions of XPath (and XQuery).

XPath 1.0 does not provide all functions necessary to develop BPEL processes. Therefore, the BPEL specification defines additional functions such as getVariableData(), getVariableProperty(), and getLinkStatus(). Oracle BPEL Process Manager provides additional extension functions to simplify the development.

Note: Using these functions limits the portability of BPEL processes, because these functions will not be available in other BPEL servers.

Oracle extension functions are defined in the following namespace URI: http://schemas.oracle.com/xpath/extension. We will use the ora prefix for this namespace, which corresponds to the following XML declaration xmlns:ora="http://schemas.oracle.com/xpath/extension".

The extension functions are related to:

  • Transformation and query support
  • Data and array manipulation
  • XML manipulation
  • Date and time expressions
  • Process identification

All Oracle-specific functions can be accessed using BPEL Designer's Function Wizard.

Transformation and Query Support

In real-world business processes we often have to match the schema of our XML document to the schema required by the partner web service. Consider our travel process example. Here we designed both the process and the partner web services, so we only had to perform minimal transformations for calling the Employee or Airlines web services. In real-world examples this will often not be the case and we will have to make more complex transformations.

To perform the transformations, we can use the BPEL <assign> activity. As this can be time consuming, Oracle provides an XSLT engine and an extension function through which we can activate the XSLT engine. This enables us to use XSLT to do more complex data transformations. Using XSLT is more appropriate than using <assign> because XSLT is the standard transformation language for XML. Also, sometimes we already have the stylesheets for transformation. This way we can easily integrate them into BPEL processes.

To activate the XSLT engine we use the ora:processXSLT() function. The function requires two parameters, the XSLT stylesheet and the XML input on which the transformation should be made.The result of the function is the transformed XML. The syntax is:

ora:processXSLT('stlyesheet','XML_input')

Usually we use this function within the <assign> activity, in the <from> clause. For example, to modify our travel process and make a more complex transformation to prepare the input for the Employee web service, we could use the XSLT engine, as shown in the following code excerpt:

<assign>
   <copy>

      <from expression="ora:processXSLT('employee.xslt',
                           bpws:getVariableData('TravelRequest',
                           'employee') )"/>

      <to variable="EmployeeTravelStatusRequest" part="employee"/>

   </copy>
</assign>

For this code to work we must create the employee.xslt stylesheet and deploy it with the process. For more information on XSLT please refer to http://www.w3.org/TR/xslt.

In addition to the XSLT engine, Oracle BPEL Process Manager also provides:

  • An XQuery engine
  • An XSQL engine

With the XQuery engine we can perform complex queries on XML documents, going beyond the capabilities of XPath. We can use the built-in XQuery engine through the ora:processXQuery() function. We have to provide the query template and the context XML on which the query should be performed:

ora:processXQuery('query_template','XML_context')

We will use the function from the <assign> activity. Suppose we would like to create the EmployeeTravelStatusResponse with an XQuery. We would have to create the query and store it into the query.xq file and use the following code snippet:

<assign>
   <copy>

      <from expression="ora:processXQuery(query.xq',
                        bpws:getVariableData('EmployeeTravelStatusRequest',
                                             'employee'))"/>
      <to variable="EmployeeTravelStatusResponse" part="employee"/>
   </copy>
</assign>

To process only a specific item, we can use the ora:processXQueryItem() function. The syntax is similar to ora:processXQuery(); here we have to provide the item:

ora:processXQueryItem('query_template','item','XML_context')

For more information on XQuery please refer to http://www.w3.org/XML/Query.

In a similar way we can use the Oracle XSQL engine. It can be activated using theora:processXSQL() function. We have to provide the XSQL template and the input XML on which the query should be performed:

ora:processXSQL('query_template','XML_input')

Data and Array Manipulation

Data manipulation in BPEL is done within the <assign> activity, where we can use XPath and BPEL functions in the <from> and <to> clauses. In addition, Oracle provides several custom functions that ease data manipulation considerably.

A very important aspect in data manipulation is arrays. In Chapter 3 we mentioned that arrays in BPEL are realized with XML elements, which can occur more than once. In XML schema they are identified with the maxOccurs attribute, which can be set to a specific value or can be unbounded (maxOccurs="unbounded"). The items are addressed with the XPath position() function, as shown in the following example:

<assign>
   <copy>
      <from variable="TicketOffer"
            part="ticket"
            query="/item[position()=1]"/>
      <to variable="FirstOffer" part="ticket"/>
   </copy>
</assign>

The short notation is:

<assign>
   <copy>
      <from variable="TicketOffer"
            part="ticket"
            query="/item[1]"/>
      <to variable="FirstOffer" part="ticket"/>
   </copy>
</assign>

Often we need to dynamically address the items. Instead of hard-coding the index we can use avariable, such as:

<variable name="position" type="xsd:integer"/>

We could then create the XPath query expression, store it in a variable, and then use this variable to address the desired item, as shown in the following example:

<assign>
   <copy>
      <from expression="concat('/item[',
                        bpws:getVariableData('position'), ']')"/>
      <to variable="itemAddress"/>
   </copy>
   <copy>
      <from expression="bpws:getVariableData('TicketOffer', 'ticket',
                        bpws:getVariableData('itemAddress'))"/>
      <to variable="SelectedOffer" part="ticket"/>
   </copy>
</assign>

Alternatively we can use an Oracle-specific function called ora:getElement(). The function takes four parameters: variable name, part name, query path, and element index:

ora:getElement('variable_name', 'part_name', 'query', index)

The previous example using this function would look like this:

<assign>
   <copy>
      <from expression="ora:getElement('TicketOffer', 'ticket', '/item',
                                        bpws:getVariableData('position'))"/>
      <to variable="SelectedOffer" part="ticket"/>
   </copy>
</assign>

We usually dynamically address items in loops using the <while> activity. To determine the number of items (array size), we can use the Oracle-specific function ora:countNodes(). The function returns the number of items as an integer and takes three parameters: variable name, part name, and query path (the last two parameters are optional):

ora:countNodes('variable_name', 'part_name', 'query')

To count the number of ticket offers in our example we could use the following code:

<assign>
   <copy>
      <from expression="ora:countNodes('TicketOffer',
                                       'ticket', '/item')"/>
      <to variable="NoOfOffers"/>
   </copy>
</assign>

To append an item to the existing items we can use the Oracle-specific function ora:addChildNode(). The syntax of the function is:

ora:addChildNode('existing_elements', 'new_item')

To add a new ticket offer to the existing offers we can use the following code:

<assign>
   <copy>
      <from expression="ora:addChildNode(
                            bpws:getVariableData('TicketOffer', 'ticket'),
                            bpws:getVariableData('NewOffer'))"/>
      <to variable="TicketOffer" part="ticket"/>
   </copy>
</assign>

To add more than one item to the existing items, Oracle provides another function called ora:mergeChildNodes(). The syntax of the function is:

ora:mergeChildNodes('existing_elements', 'new_elements')

For example, to add a several new ticket offers to the existing offers we use the following code:

<assign>
   <copy>
      <from expression="ora:mergeChildNodes(
                        bpws:getVariableData('TicketOffer', 'ticket'),
                        bpws:getVariableData('AdditionalOffers'))"/>
      <to variable="TicketOffer" part="ticket"/>
   </copy>
</assign>

We have seen that Oracle-specific functions simplify array management considerably. Next we look at functions related to XML manipulation.

Go to page: Prev  1  2  3  4  5  6  7  8  9  10  11  12  13  Next

Tools:
Add www.codeguru.com to your favorites
Add www.codeguru.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed







RATE THIS ARTICLE:   Excellent  Very Good  Average  Below Average  Poor  

(You must be signed in to rank an article. Not a member? Click here to register)

Latest Comments:
Hi,,, - harshakk (02/28/2007)

View All Comments
Add a Comment:
Title:
Comment:
Pre-Formatted: Check this if you want the text to display with the formatting as typed (good for source code)



(You must be signed in to comment on an article. Not a member? Click here to register)


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES