Tuesday 12 March 2013

How to Set a Timeout for a Web Service in SOA 11g ?


In 11g SOA we don't have anymore the "Timeout" property that we can put in Web Service invocations to set a maximum wait time in a sync BPEL invocation - so the solution presented inSetting a Timeout for a WebService invocation in BPELwill not work anymore in BPEL 11g.

I will explain below how to set a TIMEOUT on a Web Service invocation when using SOA 11g . This can only be used when only Web Service invocation is made through HTTP.

1. For a process that invokes a Web Service, we want to set a timeout of maximum 10 seconds that the SOA application will wait for the answer. If no response is received within the specified timeout, then we want to catch the timeout error and perform a series of other activities.

The sample below is for a BPEL in a SOA Composite - it will work the same way with Mediator as the timeout is set in
composite.xml file and not in some specific BPEL file .

2. Let's say the SOA composite looks like this:
3. Click on "Service1" and note that the property inspector will open in the lower right side of your JDeveloper window. Here set the property :


oracle.webservices.httpReadTimeout = 10000 (in MiliSeconds)
If the Web Service is on the same domain as the SOA Composite , you will also have to set :

oracle.webservices.local.optimization = false

By default the local optimization is TRUE and when a SOA composite invokes another SOA composite within the same Weblogic (WLS) server or cluster of WLS servers bypasses the whole SOAP stack, and makes a direct java call to optimize the invocation .




You may set these properties directly in composite.xml

<reference name="Service1"
ui:wsdlLocation="http://localhost:8001/soa-infra/services/default/Child!1.0/Child.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/test/Child/Child#wsdl.interface(Child)"/>
<binding.ws port="http://xmlns.oracle.com/test/Child/Child#wsdl.endpoint(child_client_ep/Child_pt)"
location="http://localhost:8001/soa-infra/services/default/Child!1.0/child_client_ep?WSDL">
<property name="oracle.webservices.local.optimization">false</property>
<property name="oracle.webservices.httpReadTimeout" type="xs:string" many="false">10000</property>
</binding.ws>
</reference>

4. This timeout will throw a RemoteFault - so you can easily add a Catch to your BPEL code to catch this error.

5.Now deploy the composite and run it from EM page . The Web Service we are calling takes 40 seconds to complete , but we set the timeout to 10 seconds - note that the Remote Fault occurs after 10 seconds.



Wednesday 6 March 2013

XSLT LOOKUP

Loopup info



<xsl:stylesheet version="1.0" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction" xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue" xmlns:tns="http://com.ge.cis.oraclesoa/UP_Inbound_Poller" xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://com.ge.cis.oraclesoa/validate/xml" xmlns:med="http://schemas.oracle.com/mediator/xpath" xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath" xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions" xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:ns1="http://www.com.ge.cis.oraclesoa/validation/nxml" xmlns:lookup="http://www.com.ge.cis.oraclesoa/sampletype/lookup" xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" exclude-result-prefixes="xsi xsl tns nxsd xsd ns0 bpws xp20 mhdr bpel oraext dvm hwf med ids bpm xdk xref ora socket ldap lookup">
   <lookup:definitions>
      <term name="UP4S">OIL</term>
      <term name="UP2S">OIL</term>
      <term name="UPAC">AIR_COMPRESSOR</term>
      <term name="UPCW">COOLANT_WATER</term>
      <term name="UPGL">GLYCOLE_BASED_COOLANT</term>
   </lookup:definitions>
   <xsl:key name="sampletype_lookup" match="lookup:definitions/term" use="@name"/>
   <xsl:variable name="definitions" select="document(&quot;&quot;)//lookup:definitions"/>
   <xsl:template match="/">

.....
...
.....



Function to be used is


                  <SAMPLE_TYPE>
                     <xsl:variable name="sampletype">
                        <xsl:value-of select="/tns:SMTP/tns:Data/tns:SAMPLE_TYPE10"/>
                     </xsl:variable>
                     <xsl:for-each select="$definitions">
                        <xsl:value-of select="key(&quot;sampletype_lookup&quot;, $sampletype)"/>
                     </xsl:for-each>
                  </SAMPLE_TYPE>









Monday 4 March 2013

Using JDeveloper with Subversion


Introduction

This guide takes you through the necessary steps to install Subversion and configure JDeveloper for use with it.  You will then be taken through some common scenarios encountered when working with Subversion in JDeveloper.

Installing the JDeveloper Subversion VCS extension

The JDeveloper Subversion VCS extension is available via the official Oracle update center. You install updates using the Check for Updates feature available from the Help menu:
JDeveloper Check For Updates
Using the Check for Updates wizard, search the Official Oracle Extensions and Updates center:
Choose Official Oracle Extensions and Updates
Locate and select the Subversion VCS Extension entry.  Selecting this will automatically select the VCS Framework Extension update too.
Locate and select the Subversion VCS Extension (EA2) entry
Proceed to the download stage:
Downloading using the update center
After downloading the updates, you will see a summary page with information similar to the following:
Download Summary
On completion of this wizard, you may be asked whether you want to automatically restart JDeveloper:
Restart JDeveloper
Choose "Yes".
When JDeveloper has restarted, open the Versioning menu, choose Select Version System and then Subversion.
If configuration was successful, you will see a status message below the structure pane:
Successful configuration
Assuming success, view the preferences for Subversion to check that the JavaSVN client library has been installed as expected: Open the Preferences dialog ( Tools > Preferences) and in the left pane select Versioning | Subversion.
With the extension correctly installed, you will see something like:
Preferences, JavaSVN Binding

Connecting to a Subversion repository

TIP: If you want to follow the examples given in this Developer's Guide, you will need to install a local Subversion repository named c:/svn-repos and connect to it using the svn:// protocol. The JDeveloper Subversion VCS extension will allow you to install a local repository if you also have separate Subversion client software installed. See Creating a local Subversion repository.
If you want to save the details of your Subversion repository connections so that you can use them later or on another machine, you can export them to a text file. You can then recreate the connections by importing the details from the file. To export, right-click the Subversion node in the Subversion Navigator and choose Export Connections. Complete the Export Subversion Connections dialog, then click OK. To reimport connection details from a file, right-click the Subversion node and chooseImport Connections. Through the Import Subversion Connections dialog, browse to the file that contains the connection details that you wish to import, then click OK.

Importing JDeveloper projects into Subversion

New test application details
New test application as navigator tree
svn://localhost/
c:\jdev1013\jdev\mywork\test
Repository Connection dropdown
Source Directory box
Perform Checkout checkbox
Navigator tree showing unmodified files

Checking out files

Navigator tree showing unmodified files

Adding and committing files

Navigator tree showing a new file
Pending changes window showing new file
Navigator icon showing file added
TIP: In a live development environment, to avoid unnecessary conflicts and the subsequent work in resolving them, you should update your files before committing them.

Updating files

Commit prohibited dialog

Editing files

TIP: To be certain that you are seeing the most up-to-date status of files in JDeveloper, click the Refresh button Refresh icon on the Application Navigator toolbar.
An alternative to the above is the lock-modify-unlock model, in which a developer locks a file, modifies it, adds it back to the repository, then unlocks it. Locking a file does not prevent another developer from working on a copy of the file: it prevents the content of that copy from being returned to the repository until the lock is removed. So there is still potential for wasted effort in this model.
The lock-modify-unlock model is more suitable for working with files in binary formats, where it is impossible to merge conflicting changes. It ensures that developers take it in strict turns to submit changes to a file.
In this release of JDeveloper, support for locking is limited to retaining locks on files that you are about to commit. You must previously have locked the files using the Subversion lock command. In a future release, locking and unlocking will be fully supported.
Commit resources showing keep locks
Retaining a lock will mean that other developers will still not be able to commit changes they made to their copies of the files.
To lock a file using the Subversion lock command, enter the following at a command prompt:
svn lock [file name] -m "[message]"
To unlock a file, use:
svn unlock [file name]

For more info please refer
http://www.oracle.com/technetwork/developer-tools/jdev/subversion-085144.html