Folks,
I have been using the helloworld-bpel sample as a testcase on 2.x to try to get the BPEL code
working with ODE 1.3.2 and now that I think that I've got the BPEL code working, I think I've
discovered that this BPEL Sample is actually bogus and needs fixing. If anyone thinks otherwise,
please shout now before I spend a load of effort making corrections.
There are 2 problems, I believe:
1) The CLIENT code uses a Java interface to describe the service interface implemented by the BPEL
process. The BPEL process describes the interface using a WSDL portType (naturally). Problem is
that the Java interface is *NOT* the JAX-WS mapping of the WSDL. In particular, the namespaces are
totally screwed up (as I discovered when looking at the actual data received by the BPEL process).
I believe that this should be fixed by gen-ing the Java interface from the WSDL
using the JAX-WS tools.
2) The BPEL process commits a sin by treating what is actually an XML element data structure as if
it were a String. This results in the returned data having a String ("Hello World") in place of
what should be an XML data structure containing that String.
Basically the input message should be like:
<hello>
<message>
Hello
</message>
</hello>
However, the BPEL code copies out the message contents into something that is
declared a string:
<variable name="myVar" messageType="test:HelloMessage"/>
<variable name="tmpVar" type="xsd:string"/>
...
<copy>
<from variable="myVar" part="TestPart"/>
<to variable="tmpVar"/>
</copy>
and then concatenates it with another string before putting it back into the
message variable:
<copy>
<from>concat($tmpVar,' World')</from>
<to variable="myVar" part="TestPart"/>
</copy>
The effect of this is that the <message/> element wrapper for the string disappears in the return
version of the message. This now causes a failure in the data mapping phase of the response
handling. How it ever worked before I have no idea.
To clean this up, I believe that the BPEL code should change to something like
this:
<copy>
<from>$myVar.TestPart/hello/message</from>
<to variable="tmpVar"/>
</copy>
<copy>
<from>concat($tmpVar,' World')</from>
<to>$myVar.TestPart/hello/message</to>
</copy>
... although this will require some namespace stuff too.
Or I have I completely misunderstood??
Comments welcome.
Yours, Mike.
PS I never spotted this before as I've been using a version of the OASIS Assembly test suite, with
BPEL implementation artifacts, as my test base. When I've got that test suite to a satisfactory
state, then I'll contribute it and it should give us a very solid set of tests for the basic BPEL code.