Thursday, April 30, 2009

Error: XPATH returns zero node

Problem:
Sometimes you get following runtime error message in your BPEL Console for the transform activity;

XPath query string returns zero node.
According to BPEL4WS spec 1.1 section 14.3, The assign activity part query should not return zero node.
Please check the BPEL source at line number "211" and verify the part xpath query.
Possible reasons behind this problems are: some xml elements/attributes are optional or the xml data is invalid according to XML Schema.
To verify whether XML data received by a process is valid, user can turn on validateXML switch at the domain
administration page.

Solution:
The probable reason for getting this error is due to assigning value to an element using Assign activity just after the Transform activity, for which the same element is not mapped in transformation. Assign activity attempts to update an element not being transformed in Transform (the element without any value).

Following steps should be done to overcome this problem:

1) Goto the transfomation mapper file
2) Right-click on the element that the Assign activity in going to use for assigning value in the next step
3) Select Set Text
4) Set any temporary value there. This will be overwritten by the Assign activity in the next step anyways.

9 comments:

thsunamy said...

Thanks.

Anonymous said...

You saved my day! Thank you so much :)

బాటసారి said...

Hi
I am getting the same error when I try to assign the variable using setVariableData in java embedding in the below scenario.

1. I need to set header variables which I want to parametrize.
2. For this, I am reading those parameters from the file and setting in the header variable of a remote process(exposed as a webservice).
I am using Properties class to read the file.

***
setVariableData("invokePMM_UPLOAD_ROW_InputVariable","header", stXpath, stValue)

where :
String stXpath = "/ns30:SOAHeader/ns30:"+stProperty;
stValue = prop.getProperty(stProperty).trim();


Can you kindly suggest me on this ?

Thanks in Advance

బాటసారి said...

Thnx Abhishek.
I created a transformation and assigned temporary values in the text just before this java code and it worked.

Now I see the values in the Header.
Thnx for this post.

ananth said...

thanks abhishek, it worked for me

Prashant Fauzdar said...

Many Thanks Abhishek. WOrked for me too :)

Prateek said...

Thanks a lot... It worked :)

vikram jaddu said...

thanks abhishek

Wasia Kulsum said...

Hi Abhishek
After doing set text I got a error saying multiple nodes are returned