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 » Putting XML in a MbElement in java plugin

Post new topic  Reply to topic
 Putting XML in a MbElement in java plugin « View previous topic :: View next topic » 
Author Message
jlalbor
PostPosted: Wed Feb 19, 2003 11:25 pm    Post subject: Putting XML in a MbElement in java plugin Reply with quote

Apprentice

Joined: 18 Feb 2003
Posts: 38

Hi i'm having problems to assign an xml in a MbElement, here is the problem.

I ve made a java plugin node that gets an xml from the message of the assembly. I read some values from this xml and use them in another class that returns a String, this String has an xml document that i want to put in the message that the plugin propagates.

I understand that i cant not create a new blank message in a plug in unless its an input plug in, so i use a copy of the message using the following code:

MbMessage newMsg = new MbMessage(assembly.getMessage());

This newMsg has an xml , but this xml is useless for me now, i need to delete it and assing my new xml (that is in the String ) to this new message.

I ve read the javadoc but i dont know how i can do this. is it possible to do this?

i detach de xml element, and that works find, but im having problems to assign the new xml, Here is the code :

MbMessage newMsg = new MbMessage(assembly.getMessage());
newMsg.getRootElement().getLastChild().detach();
MbElement element1 = newMsg.getRootElement().createElementAsLastChild("NONE");
MbElement element2 = element1.createElementAsFirstChild(MbElement.TYPE_VALUE);
element2.setValue(corbaExecutionResult);
MbOutputTerminal out = getOutputTerminal(_OUT_TERMINAL);
MbMessageAssembly newAssembly = new MbMessageAssembly(assembly, newMsg);
out.propagate(newAssembly);

where corbaExecutionResult is a java.lang.String that contains an xml like this one:

<?xml version = "1.0"?>
<ConsultaControlVehicular>
<Action>Answer</Action>
<Result>FAIL</Result>
<Resultado_Trans>2</Resultado_Trans>
<Control>
<NET>GOVERNMENT</NET>
<Collaborator>
<Roll>Receiver</Roll>
<Entity id = "Banco">
<SWIFT>BNMXMXMM</SWIFT>
<ABA>aba</ABA>
<Name1>Banco Nacional de Mexico</Name1>
</Entity>
</Collaborator>
<Collaborator>
<Roll>Sender</Roll>
<Entity id = "Provider">
<Name2>Gobierno del Estado de Baja California</Name2>
</Entity>
</Collaborator>
</Control>
<Operation>
<Key>
<Placas>886NUN5</Placas>
<Serie>1JCMT7747JT074377</Serie>
</Key>
<Error>0</Error>
<ErrorMsg>Error:El Vehiculo Tiene un Tramite Similar Activo
(Folio 114100000040)</ErrorMsg>
</Operation>
</ConsultaControlVehicular>


This code does not throw an execption, but it does not work properly either because it propagates an empty Message, the setValue method its not working.


If i change this line:

MbElement element1 = newMsg.getRootElement().createElementAsLastChild("NONE");

using "BLOB" or "XML" instead of "NONE" the next exeption is thrown

El intermediario de mensajes ha detectado un error mientras procesaba un mensaje en el nodo {0}. Se ha recibido una excepcion para detener inmediatamente el proceso del mensaje.

Consulte los mensajes siguientes para ver mas detalles sobre el error. : Caught exception and rethrowing > -- <com.ibm.broker.plugin.MbBrokerException source:
MQIv210 key:2230 message:[WMQIv210:2230]BIP2230E: Se ha detectado un error mienras se procesaba un mensaje en el nodo '{0}'.

El intermediario de mensajes ha detectado un error mientras procesaba un mensaj en el nodo {0}. Se ha recibido una excepcion para detener inmediatamente el prceso del mensaje.

Consulte los mensajes siguientes para ver mßs detalles sobre el error. : Caught exception and rethrowing >
<com.ibm.broker.plugin.MbBrokerException source:WMQIv210 key:2230 message:[WMQ
v210:2230]BIP2230E: Se ha detectado un error mientras se procesaba un mensaje en el nodo '{0}'.

El intermediario de mensajes ha detectado un error mientras procesaba un mensaje en el nodo {0}. Se ha recibido una excepcion para detener inmediatamente el proceso del mensaje.

Consulte los mensajes siguientes para ver mas detalles sobre el error. : Caught exception and rethrowing >
at com.ibm.broker.plugin.MbOutputTerminal._propagate(Native Method)
at com.ibm.broker.plugin.MbOutputTerminal.propagate(MbOutputTerminal.ja
a:126)
at com.gbc.wmqi.CORBAPlugin.CORBAExecutionNode.evaluate(CORBAExecutionN
de.java:265)

(CORBAExecutionNode its my java class that extends from MbNode)

In english its something like this:

The broker has detected an error while procesing a message in the node {0}. An exeption has been received to stop immediately the process of the message.

Read the following message to see more details of the error.

And thats it, the text repeats like 3 times, and there are no more detailed messages about the error

Has anyone done something like this? or are there any suggestions?

Help please.
Back to top
View user's profile Send private message
warrenpage
PostPosted: Thu Feb 20, 2003 9:40 pm    Post subject: You should use BLOB but you need to convert your String Reply with quote

Acolyte

Joined: 19 Feb 2002
Posts: 56
Location: Australia

You should use BLOB/BLOB but you need to convert your String to a Byte Array


MbElement blobdomain = newMsg.getRootElement().createElementAsLastChild("BLOB");
MbElement blobvalue = blobdomain.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"BLOB",corbaExecutionResult.getBytes());


P.S. can't guarantee the code works as is, but you should get the idea
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
fcotait
PostPosted: Thu Dec 16, 2004 8:41 pm    Post subject: Reply with quote

Acolyte

Joined: 28 Feb 2002
Posts: 63
Location: Sao Paulo - Brazil

Hi jlalbor,

Have you resolved your problem ? I have the same error and I can't fix this error.

Tks
_________________
Filipe Cotait
IBM Certified System Administrator - WebSphere MQ
IBM Certified Specialist - MQSeries, WebSphere MQ Integrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website 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 » Putting XML in a MbElement in java plugin
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.