Doorgaan naar hoofdcontent

Posts

Er worden posts getoond met het label xquery

Automatic XQuery unit tests for OSB projects

Within the OSB 10.3 you use XQuery code to perform data transformations. These transformations can be very complex. I am in favor of TDD and i want to use automatic tests for XQueries. You can use the OSB Console to test XQueries but this is not very practical with complex Queries and takes a lot of time.You can also use XQuery and JDeveloper to run XQueries and this inspired me to write a simple XQUnit module to test xqueries. This blog shows you how to set up automatic tests with the use of JUnit , XMLUnit and Oracle XQuery engine. The contraints for me were: 1) The XQuery code should be as-is, so no changes with scripts or whatever. The XQueries are used within the test framework as used within the OSB. 2) The XQuery engine of the WLS must be used. I could use some other XQuery engine, but this would not test the real WLS engine and still errors could occur runtime. 3) The test framework can be used within Java unit tests. This way it can also be used within Maven for instanc...

Reuse XQuery within OSB 10gR3

XQuery is a great language that can be used within the OSB for translations and other expressions. Unfortunately the OSB does not support the module construction of XQuery. A module construction can be perfectly reused for code reuse. This post shows how this omission in the OSB can be solved. This example shows how a message with a header and a body can be created of which the header code is reused. 1) First the header function is created (without parameters, but these can also be added). 2) Add another XQuery that creates the message with the header and body content as parameters. 3) Within a Stage or where you want to use the construction add an Assign. 4) The expression must be the Header XQuery. 5) Add another Assign for the message XQuery and add the $body and $header as binding variables. And that's it, so the trick is to use parameters. This may be not always possible but it is a construction you could use.

Dynamic transformations in OSB 10gR3

Here is an interesting post from Chris about dynamic transformations within the OSB. It looks great, but think about this: You loose the strong typing of the messages the proxy can receive (as described in the blog itself). This may lead to faults that are difficult to trace because the service contract is in fact far more coarse grained. How about maintenance? I like the approach that for a different major version of a service with different XML data, use a different proxy. This way services of different versions can live together and services can become obsolete when clients are no longer using the old service. If you try to put all versions of the service in one proxy service it can soonly become unmanageable. But it can still be useful to have dynamic transformations.

XQuery use within OSB, watch out!

I came accross an issue when using an XQuery resource within an assign. I could not see the binding variable, it turned out that the external variable within the .xq code was not used within the XQuery code. In this case the OSB does not show the variable! I entered the next code: Then I wanted to use this .xq within an Assign and opened the XQuery Expression Editor. However the Variable Binding (which is used to assign a value to the externally defined XQuery variable) is not shown: When I now actually use the external variable: The OSB now shows the variable: So watch out when tou are setting up the code, that you actually use the external variable otherwise the OSB does not show you the variable!