Tuesday, 8 May 2012

Convert xsd:anyType data into XML Data

Recently I encountered this requirement to Accept AnyType Data and convert it into a valid xml data.

Few important things to consider is: The AnyType data payload should be a valid one with the namespaces defined.The type to be converted to should be declared in an xsd.

In my process I had to get this anyType data and convert it to a format with which I had to invoke a service.
Though it sounds very simple I felt its better to document it in a very easily accessible way. I followed the following steps for the same in SOA 11.1.1.4:

  1. Create 2 variables to which you want to convert the anytype Data to.
  2. Use the following function to Parse the value:oraext:parseXML(bpws:getVariableData('inputVariable','request','/ns2:Request/ns2:Details/ns2:xmlData')) where xmlData is of datatype Any.Please note that when you are selecting the anyType data, in Assign activity this will not get copied in the expression builder, hence you need to manually add this data.
  3. Once this Assign activity is completed, use Assign or Transform activity to transform the values within the xml generated in the above mentioned step to another variable which is used to invoke the service.
I hope this helps for people looking for usage of oraext:parseXML.


Dynamically Set Archive Drectory Location for FTP Transfer

In Some of the scenarios of FTP File transfer in a typical BPEL Process, we might need to set the location of Archive Directory  dynamically, either by picking from some configuration properties file or from the payload at runtime. To achieve this we need to follow the below mentioned steps:

  1. In FTP WSDL file set the jca properties to select logical directories for Archive or source file location directory.Also Set the property "UseRemoteArchive"  to true.  
              <jca:operation FileType="binary"
              LogicalDirectory="directory"
              InteractionSpec="oracle.tip.adapter.ftp.outbound.FTPReadInteractionSpec"
              LogicalArchiveDirectory="FileArchiveDirectory"
              DeleteFile="true"
              FileName="fileName"
              OpaqueSchema="true"
              UseRemoteArchive="true" >
  2. In the BPEL service flow, when we invoke the FTP adapter to either get/put files, we can see that bpel.xml file gets update with the partner link binding details. In the partner link binding details keep the values blank for LogicalArchiveDirectory.                                                                                                      <property name="FileArchiveDirectory" type="LogicalArchiveDirectory"></property>.
  3. However we can set the outbound directory location by using ftpAdapterOutboundHeader. We cannot do the same for the Archive Directory. Hence we will use the following function in the JavaEmbedding to set the ArchiveDirectory.                                      Location.getLocator().lookupProcess("<<ProcessName>>").getDescriptor().getPartnerLinkBindings().getPartnerLinkBinding("<<PartnerLinkBindingName>>").setPropertyValue("FileArchiveDirectory",(String)getVariableData("archiveDir"));  
    }    
    catch(Throwable ex){  
    addAuditTrailEntry("Exception - " + ex.getMessage());  
    }    
                          This way we can set the Archive Directory Location in the bpel.xml file dynamically  where getVariableData("archiveDir") is the archive directory location variable set in the bpel flow.                                     

Wednesday, 1 February 2012

JTA transaction is not present or the transaction is not in active state

You might have faced this strange error in your BPEL flow which occurs when you are connecting to a particular Partner link from the BPEL process. If this occurs in 10.1.3.5 server you can resolve it by following the steps mentioned below. The error thrown will have the error details as:


ORABPEL-02182
JTA transaction is not present or the transaction is not in active state.
The current JTA transaction is not present or it is not in active state when processing activity or instance "100560639-BpInv4-BpSeq4.3-9". The reason is The execution of this instance "100560639-BpInv4-BpSeq4.3-9" for process "XYZ" is supposed to be in a jta transaction, but the transaction is not present or in active state, please turn on the application server transaction debug logs to get more information..
Please consult your administrator regarding this error.


To resolve this you have to follow the following steps:
  1. Stop the SOA Server 
  2. Set Transaction-timeout value to 7200 or more in the following file: $SOA_Home\j2ee\config\transaction-manager.xml
  3. Set transaction-timeout value to 3600 or more in $SOA_Home\j2ee\application-deployments\orabpel\ejb_ob_engine\orion-ejb-jar.xml 
  4. Set syncMaxWaitTime to 240 or more in $SOA_Home\bpel\domains\config\domain.xml.
  5. Restart the SOA server.
This should resolve the JTA transaction issue

Wednesday, 25 January 2012

Unable to trasfer files using FTP Adapter in BPEL

IF you face issues to do an FTP transfer to the remote location from your BPEL / ESB code Please check and verify the following:

  1. Check the connection details for that particular Connection factory. You would have given these connection details like host, port, username, password either in the wsdl of the process or you would have referred to a JNDI whose connection details are given in $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/{domain_name}/FTPAdapter /oc4j-ra.xml file.check these connection details with some external FTP clients too.
  2. If the connection is still failing change the port to either 21 or 22 and test it.
  3. If the password has expired, refresh the password to the existing one or change it to a new password.
  4. If the connection to the remote location is successful but the files are still not getting transferred then check the property UseSFTP in oc4j-ra.xml file.This value should be set to true in case you are making secure ftp connection.
  5. If these values are set and still not able to make the FTP connections, check the permissions on the folder.
  6. Last but not the least check if the file which has to be transferred exists and has access permissions,