Monday 23 March 2009

How to validate xml in bpel process (during transformation)

In your bpel process after you pick any message/xml from any source/adapter we can validate the xml message by doing the following

Open bpel process *. bpel file in source mode and add the following attribute to transformation activity
bpelx:validate="yes"

Example:
-----------------
<assign name="Transform_DBRead_Result_To_CDM"
bpelx:validate="yes">
<?xml:namespace prefix = bpelx /><bpelx:annotation>
<bpelx:pattern>transformation</bpelx:pattern>
</bpelx:annotation>
<copy>
<from expression="ora:processXSLT('Transformation_A_To_B.xsl',bpws:getVariableData('Result_receive_InputVariable','HeadersVCollection'))">
<to variable="Variable_CDM">
</copy>
</assign>

[Error ORABPEL-10902]: compilation failed XML parsing failed because "". [Potential fix]: n/a

Some times when you compile the bpel process you get error code ORABPEL-10902 with the following error

[Error ORABPEL-10902]: compilation failed
[Description]: in "C:\soa\bpel\HelloWorld\bpel\HelloWorld",
XML parsing failed because "". [Potential fix]: n/a.

The JDeveloper error message does not say more, especially the last one, "Potential fix: n/a". But it is possible to get more details of the error. This is done via build.xml file that JDeveloper creates for your bpel process.

Do the following steps:

1)In build.properties Set 'verbose' to 'true' (by deafult its set to false & its commented)

# Set verbose to true if you want to see verbose output from deployment tasks
verbose = true

2)In build.xml file, under <target name="compile"> section add verbose="${verbose}" as attribute to <bpelc>
<target name="compile">
<echo>
--------------------------------------------------------------
Compiling bpel process ${process.name}, revision ${rev}
--------------------------------------------------------------
</echo>
<bpelc input="${process.dir}/bpel/bpel.xml" verbose="${verbose}" out="${process.dir}/output"
rev="${rev}" home="${bpel.home}"/>
</target>

3)Now Right click on build.xml and then run ant task (ex: compile,deploy)

Note*: You can run the respective ant task dependeing on where & when you are getting this error (i,e during compile time or during deployment)