[Bpmscript-users] jbi operation parameter required
Status: Beta
Brought to you by:
dkfn
|
From: jpangburn <jes...@qu...> - 2006-09-06 21:01:49
|
Hi,
This is a suggestion more than a question. =20
In regards to JBI integration, many JBI services require that you specify
the "operation" to the service that you are invoking. For example, invokin=
g
a BPEL service always requires the operation to be specified. The current
version of the send function only has the following parameters: namespace,
localPart, service, message, properties. I tried setting an "operation" an=
d
then an "Operation" property, and these were properly set as properties of
the jbi message, but the message's operation field remained null. I
resolved this problem by modifying the send function to look like this:
this.send =3D function(namespace, localPart, service, message, properties,
operation) {
=09return this.sendTemplate(namespace, localPart, service, function(inOut) =
{
=09=09if(operation !=3D null) {
=09=09=09inOut.setOperation(operation);
=09=09}
=09=09var inMessage =3D inOut.createMessage();
=09=09if(properties !=3D null) {
=09=09=09for(var property in properties) {
=09=09=09=09inMessage.setProperty(property, properties[property]);
=09=09=09}
=09=09}
=09=09if(message !=3D null) {
=09=09=09inMessage.setContent(message);
=09=09}
=09=09inOut.setInMessage(inMessage);
=09});
};
This creates an optional "operation" field which sets the MessageExchange's
operation field. The operation field is actually a QName, so here's a
sample process definition to invoke it:
function main(input, sender) {
=09var qname =3D new Packages.javax.xml.namespace.QName("urn:/HelloWorld2.w=
sdl",
"Hello");
// send a message to the BPEL component=E2=80=99s HelloService service
var future =3D sender.send("urn:/HelloWorld2.wsdl",=20
"HelloService", true,
input.getInMessage().getContent(), null, qname);
=20
// get the result from the future
var exchange =3D future.get();
// echo the reply to the calling component
sender.reply(exchange.getOutMessage().getContent());
}
You'll note that I created a Java QName object to pass, though it might be
nice to modify the send function to take a string representation instead
(e.g. "{urn:/HelloWorld2.wsdl}Hello") and parse that into a real QName
object. Also, I passed null for properties so I could get to the operation
parameter. Depending on how much others agree that's required, perhaps
operation should come before the properties to avoid the need for always
passing that null parameter.
--=20
View this message in context: http://www.nabble.com/jbi-operation-parameter=
-required-tf2229536.html#a6179732
Sent from the BpmScript - Users forum at Nabble.com.
|