vrijdag 25 maart 2016

EJB Adapter quirck?

On the internet, you can find many blog posts about the Soa Suite 12c. This is not one of them. It is about the EJB adapter, running on 11g, and recently we experienced an issue with it. There are many excellent tutorials and blogs about the EJB adapter. For instance, enjoy this one. I know we did. The bean method we wanted to invoke from within our bpel process looked like this:

@Webresult(name="result")
String getResult(@Webparam(name="

param1") String param1, @Webparam(name="param2") Long param2) { .... }

As you may have noticed, this is a simplified example but it serves it's purpose. We followed the blog, created the reference in our composite and invoked the method with parameters from within our bpel process. And, lo and behold, we got our expected result back!

All was well......not!

In some cases, the second argument (param2) could be empty. This meant that in our bpel, the inputvariable to the bean method would look like this:

<param1>someString</param1>
<param2/>


And suddenly, we did not get our expected result back! No error message, no beautiful stack dump, just an empty response. What was happening?

As it turned out, when not supplying a value to the argument, somewhere along the way, the adapter uses the default value. For type Long, this is 0L. To prevent this behaviour, you have to explicitly provide a null value. So our input had to look like this:

<param1>someString</param1>
<param2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>


This solved the issue for us. Many thanks to Lida van Losser for helping us fix the problem!