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 :
[sourcecode language=”xml”]
The number of parameters for registered XQuery resource System1_To_Fault does not match that given to it at runtime
[/sourcecode]
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):
[sourcecode language=”xml”]
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:Server
some description
some string to the resource

{$metadata1}
{$metadata2}
{$metadata3}


};

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)
[/sourcecode]

xquery2 fragment (will fail):
[sourcecode language=”xml”]

soapenv:Server
some description
some string to the resource

{$metadata1}
{$metadata2}



[/sourcecode]

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
[sourcecode language=”xml”]
let $temp := $metadata3
return

soapenv:Server
some description
some string to the resource

{$metadata1}
{$metadata2}



[/sourcecode]

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>