Re: [Bpmscript-users] jbi operation parameter required
Status: Beta
Brought to you by:
dkfn
|
From: dkfn <jam...@gm...> - 2006-09-12 10:48:25
|
Hi,
Thanks for the update, I'll add it to the next release so that we can
support jbi operations.
cheers,
j.
jpangburn wrote:
>=20
> Hi,
> This is a suggestion more than a question. =20
>=20
> In regards to JBI integration, many JBI services require that you specify
> the "operation" to the service that you are invoking. For example,
> invoking a BPEL service always requires the operation to be specified.=20
> The current version of the send function only has the following
> parameters: namespace, localPart, service, message, properties. I tried
> setting an "operation" and then an "Operation" property, and these were
> properly set as properties of the jbi message, but the message's operatio=
n
> 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});
> };
>=20
> 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) {
>=20
> =09var qname =3D new
> Packages.javax.xml.namespace.QName("urn:/HelloWorld2.wsdl", "Hello");
> // send a message to the BPEL component=E2=80=99s HelloService servic=
e
> 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();
>=20
> // echo the reply to the calling component
> sender.reply(exchange.getOutMessage().getContent());
>=20
> }
>=20
> You'll note that I created a Java QName object to pass, though it might b=
e
> 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
>=20
--=20
View this message in context: http://www.nabble.com/jbi-operation-parameter=
-required-tf2229536.html#a6263608
Sent from the BpmScript - Users forum at Nabble.com.
|