SoapUI and XQuery

Because I have been looking for this a long time, I will post it here.

In Soapui you have assertions. One of the types is XQuery. An example can be found here.

What it does not explain, you need to add the XML elements around. So this:

declare namespace ns1='http://what/a/namespace/it/is';
{
for $e in //ns1:ValidationFault/ns1:ValidationErrors/ns1:ValidationError
return {$e/ns1:Error/text()}
}

should be:

declare namespace ns1='http://what/a/namespace/it/is';

<errors>
{
for $e in //ns1:ValidationFault/ns1:ValidationErrors/ns1:ValidationError
return <error>{$e/ns1:Error/text()}</errors>
}
</errors>

The related and not so helpfull error message:

XQuery Match Assertion failed for path [declare namespace ns1='http://what/a/namespace/it/is'; { for $e in //ns1:ValidationFault/ns1:ValidationErrors/ns1:ValidationError return {$e/ns1:Error/text()} }] : RuntimeException:java.lang.reflect.InvocationTargetException

My problem was very simple, but I had a hard time finding an answer. So to put it here, will make sure I never forget.

Advertisements
SoapUI and XQuery

6 thoughts on “SoapUI and XQuery

  1. This was almost helpful… still you’re “so this” and “should be” look exactly the same. Is this even a solution?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s