Oracle Service Bus, The number of parameters for registered XQuery resource System1_To_Fault does not match that given to it at runtime

To be able to make use of Dynamic Xquery the xqueries itself all need to have the same defined interface.

So after defining the different xqueries and test them one by one in Eclipse all seem to work.
On runtime i get the next error :

The number of parameters for registered XQuery resource System1_To_Fault does not match that given to it at runtime

I was pretty sure after logging all the binded input variables they were all containing data.

Lesson learned : Make sure you both bind all the variables but also ‘use’ them in the xquery itself.
OSB will return this fault either when you don’t bind all the variables but also if you don’t use all of them in the xquery

xquery1 fragment (will work):

xquery version "1.0" encoding "Cp1252";

declare function xf:System1_To_Fault(
    $metadata1		      as xs:string,
    $metadata2		      as xs:string,
	$metadata3		      as xs:string)
    as element(soapenv:Fault) {
		<soapenv:Fault>
		<faultcode>soapenv:Server</faultcode>
		<faultstring>some description</faultstring>
		<faultactor>some string to the resource</faultactor>
		   <detail>
				<info1>{$metadata1}</info1>
				<info2>{$metadata2}</info3>
				<info3>{$metadata3}</info3>
		   </detail>
		</soapenv:Fault>
};

declare variable $metadata1 as xs:string external;
declare variable $metadata2 as xs:string external;
declare variable $metadata3 as xs:string external;

xf:System1_To_Fault($metadata1, $metadata2, $metadata3)

xquery2 fragment (will fail):

		<soapenv:Fault>
		<faultcode>soapenv:Server</faultcode>
		<faultstring>some description</faultstring>
		<faultactor>some string to the resource</faultactor>
		   <detail>
				<info1>{$metadata1}</info1>
				<info2>{$metadata2}</info2>
				<info3/>
		   </detail>
		</soapenv:Fault>

inputvariable ‘metadata3’ isn’t used in the xquery itself, so the dynamix xquery will fail on runtime
either make sure you always use all the input variables in the xquery (or do an expression on it, for example assign it to an temp variable but don’t use it for generating your target xml)
something like this

    	let $temp := $metadata3
    	return 
   			<soapenv:Fault>
			<faultcode>soapenv:Server</faultcode>
			<faultstring>some description</faultstring>
			<faultactor>some string to the resource</faultactor>
		   	<detail>
				<info1>{$metadata1}</info1>
				<info2>{$metadata2}</info2>
				<info3/>
		   	</detail>
			</soapenv:Fault>

I’m not sure what this assign will do (performance-wise) when you assign a big dom-tree variable, in that case you could just assign the deepest childnode to the temp variable.
Eventually it’s just a dirty fix to be able to use the xqueries in combination with dynamic xquery and still be able to not use all of the incoming parameters.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

4 Responses to “Oracle Service Bus, The number of parameters for registered XQuery resource System1_To_Fault does not match that given to it at runtime”

commenter

I found that “mearly” referencing the input parameter in a variable was not enough.
I ended up with actually referencing the input parameter inside my response, e.g.

(: Dirty fix :)
{
if ($metadata3)
then ()
else ()
}
soapenv:Server
some description
some string to the resource

{$metadata1}
{$metadata2}

commenter

Hi Orjan!

This indeed got slightly changed in some new release of the osb. Before myfix worked, at my current client were also using some sort of fix like yours. Thanks for mentioning it in here!

commenter

Thanks a lot for this help. This resolved the same issues I was facing.

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>