Friday, January 17, 2014

According to BPEL4WS spec 1.1 section 14.3, the from node value should not be empty

I was trying to parse an XML data and i got this issue which led me to do a R&D on how the XML parsing works in BPEL.


faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage} parts: {{ summary=The <from> value is invalid. The result of from-spec is null. Either the from node value or the xpath query in the from node value was invalid. According to BPEL4WS spec 1.1 section 14.3, the from node value should not be empty. Verify the from node value at line number 99 in the BPEL source. }

In this document i will try to capture a sample that will raise this error and then will try to fix it.

First of all we will create a sample schema file and we will try to parse the xml document of that type.


Based on the above schema i create a sample XML document to parse

<TestData>
<Sample>
<name>Arpit</name>
<id>123</id>
</Sample>
</TestData>

Now lets create a soa process to use this xml data for parsing.

Create a simple BPEL process. An drag and drop an assign activity in the bpel.

Create a String variable first to store the data.



Using an assign activity pass the xml data in to the string variable you created



Create another variable of element type and this time make it based on the schema you have.



Now use another assign activity and parse the Variable1 to map to the new variable created.



Create one more variable to store the parsed data.



Use one more assign activity to map one of the field to this newly created variable.




Deploy your process and test it.

Now if you will check the BPEL instance you will that it has converted the data successfully in to XML format but when it comes to parse the data from the element it has failed with an error.



This error occurs because our xml data is not namespace qualified and the BPEL engine gets confused how to parse this data.

In order to resolve this issue we just need to add namespace to the XML data that we are passing.

So now our XML input will appear something like this.

<xxcust:TestData xmlns:xxcust="http://www.oracle.com/EBS/Event/Data/V1">
<xxcust:Sample>
<xxcust:name>Arpit</xxcust:name>
<xxcust:id>123</xxcust:id>
</xxcust:Sample>
</xxcust:TestData>

Go back to your development and assign this new payload instead of the previous one



Redeploy your process and test if from console again.

You should be able to see the correct result



Important - Make sure you are using a unique namespace identifier.

This concept can be used when you are trying to subscribe data from Apps event and you create your event data based on a schema.

No comments: