ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WBI MB User Defined Node in Java - How to Build a Response?

Post new topic  Reply to topic
 WBI MB User Defined Node in Java - How to Build a Response? « View previous topic :: View next topic » 
Author Message
AlexCosta
PostPosted: Tue Jan 11, 2005 12:11 am    Post subject: WBI MB User Defined Node in Java - How to Build a Response? Reply with quote

Novice

Joined: 16 Dec 2004
Posts: 11

Hello,
I'm using a costum node developed in java. Every thing is working fine but i can't find any documentation regarding the construction of a new message to pass forward to the flow...
Can someone please tell me where i can find that documentation?
Tks
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Tue Jan 11, 2005 5:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wbihelp/index.jsp?topic=/com.ibm.etools.mft.doc/as09970_.htm

The section entitled "Transforming a message object".
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
AlexCosta
PostPosted: Tue Jan 11, 2005 7:06 am    Post subject: Reply with quote

Novice

Joined: 16 Dec 2004
Posts: 11

Hello,

The situation is a litle different because we recieve an XML string message, but we need to create a reply with a new XML in a string returned from our java code, that is completly diferent from the income.

The complete scenario is a send and wait for response by an MQ Client.
when the message gets into the queue, it fires up a workflow with our custom Java Node.
We can already access the message content, but i cant reply with a new message (containing the XML string produced by my underlying java code).

Already tried to use the MbElement.createElementAsLastChildFromBitstream api but an exception ocours.
Why is there no example Java code for more complete operations?
The two samples provided just transform the content, and its after parsed and only changes an element of the message.

I really only wanted to integrate into a Java Node my code to "prxoxy" test messages from my own custom classes to/from the queue.

Sorry about the long text, but this is an importante project that needs to be integrated into WBI.

Thanks in advance
Back to top
View user's profile Send private message MSN Messenger
jefflowrey
PostPosted: Tue Jan 11, 2005 7:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can only create a new MbMessage inside an input node.

You can copy the incoming message as shown, and then delete the old message contents, and then use createElementAsLastChildFromBitstream.

Or you can assign your result string (containing XML Data) to an element in Environment or LocalEnvironment, and then use ESQL to Create Field Parse.

The API for createElementAsLastChildFromBitstream says "This method can only be used to create a message body i.e. last child of message root."

So trying to use it to add a field to an existing XML message won't work.

There are support packs that have Java code with them.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
AlexCosta
PostPosted: Tue Jan 11, 2005 7:36 am    Post subject: Reply with quote

Novice

Joined: 16 Dec 2004
Posts: 11

Thats right.

In my Java node, i copy the incoming message.
Then i try to use that method (createElementAsLastChildFromBitstream) to replace the response content.
It gives a strange exception when the flow is executed.
Do you have an example with a similar functionality?

I think that the Parser class that the method needs is incorrect...

Meenwhile, i am checking the IA97.zip Support pac to see the diference from what i am doing.

The fact is:
-------------

i have a complex java code with this interface:
String returnXML = MyClass.processRequest(String incommingXML);

and i wanted to integrate into a WBI node.


Thanks for any help you can provide, sample code, anything!
Back to top
View user's profile Send private message MSN Messenger
mgk
PostPosted: Tue Jan 11, 2005 8:07 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

You do not say what verison of the Broker you are using, but if it is V5 CSD4 then you could also look at using the ESQL Calling Java methods directly feature instead. This should do what you want, if I understand your post correctly you are simply trying to call one Java method that takes as string, returns a different string and then trying to propogate a new message containing the returned string as an XML message. If this is correct the following steps should do the trick:

in a compute node (V5 CSD4):
============-----------
SET replyString = myJavaMethod(InputString)
CREATE LASTCHILD of OutputRoot DOMAIN 'XML' PARSE replyString etc...

Note:
You will need to CAST replyString to a BLOB I think.


Cheers,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
AlexCosta
PostPosted: Wed Jan 12, 2005 6:59 am    Post subject: Reply with quote

Novice

Joined: 16 Dec 2004
Posts: 11

I really need a Java processing node, or in last resort a Java input node.
There should be a simple example on building the response from scratch and passing it to an output terminal.
A sample that i found has this code:

String msgg = "testmessage";
byte[] data = msgg.getBytes();
MbMessage msg = createMessage(data);
MbMessageAssembly newAssembly = new MbMessageAssembly(assembly, msg);
MbOutputTerminal out = getOutputTerminal("out");
if(out != null) out.propagate(newAssembly);

but it gives an exception in propagate:
[BIPv500:2230]BIP2230E: Error detected whilst processing a message in node '{0}'.

The message broker detected an error whilst processing a message in node '{0}'. An exception has been thrown to cut short the processing of the message.

See the following messages for details of the error. : Caught exception and rethrowing
<com.ibm.broker.plugin.MbBrokerException source:BIPv500 key:2230 message BIPv500:2230]BIP2230E: Error detected whilst processing a message in node '{0}'.

The message broker detected an error whilst processing a message in node '{0}'. An exception has been thrown to cut short the processing of the message.

See the following messages for details of the error. : Caught exception and rethrowing >
at com.ibm.broker.plugin.MbOutputTerminal._propagate(Native Method)
at com.ibm.broker.plugin.MbOutputTerminal.propagate(MbOutputTerminal.java:126)
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WBI MB User Defined Node in Java - How to Build a Response?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.