将 XmlBean.XmlObject 传递给 MessageDrivenBean
我在 Weblogic 10.3 中有一个进程,它接收一个 XmlObject,将该 XmlObject 中的一些值写入表中,然后将该 xml 传递到 JMS 队列。
public void clientRequest(org.apache.xmlbeans.XmlObject x0) {
this.newMail = x0;
}
收到 xml 后,我会解析它以获取数据值,完成创建新文档的动作,并使用该文档填充新的 weblogic.jms.extensions.XMLMessage 以发送到队列。
XMLmsg = qcon2.createXMLMessage();
..
Create Document elements
..
..
..
XMLmsg.setDocument(doc);
qsender.send(XMLmsg);
我的问题是,为什么我不能直接将 xmlbeans.XmlObject 传递到 JMSQueue?或者至少从传入的 XML 中提取文档,然后将其放入新创建的 weblogic.jms.extensions.XMLMessage 中,以便可以将其传递到队列中。
我已经尝试过这种性质的东西,但我得到的只是 java.lang.NullPointerException
Document doc = (Document) newMail.getDomNode();
但是,它可能与以下情况永远不真实有关......有什么想法吗?这里的最佳实践是什么?谢谢
node.getNodeType() == node.DOCUMENT_TYPE_NODE
I have a Process from within Weblogic 10.3 that takes in an XmlObject, writes some values from that XmlObject into a table, then will be passing that xml to a JMS queue.
public void clientRequest(org.apache.xmlbeans.XmlObject x0) {
this.newMail = x0;
}
Once I receive the xml I then parse through it to get the data values, went through the motions of creating a new Document and populated a new weblogic.jms.extensions.XMLMessage with that document to send to a queue.
XMLmsg = qcon2.createXMLMessage();
..
Create Document elements
..
..
..
XMLmsg.setDocument(doc);
qsender.send(XMLmsg);
My question is, how come I cannot just pass the xmlbeans.XmlObject directly to the JMSQueue? Or at least extract the Document from the incoming XML, then place it into the newly created weblogic.jms.extensions.XMLMessage so it can be passed into the queue.
I've tried something of this nature, but all I'm getting back is java.lang.NullPointerException
Document doc = (Document) newMail.getDomNode();
However, it probably has something to do with the following case never being true... any ideas? What's the best practice here? Thanks
node.getNodeType() == node.DOCUMENT_TYPE_NODE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管可能不是最佳实践,但我只是将 XML 消息的文本设置为传入的 XML。
另一种解决方案是进行 XML 转换并将其存储到变量中。尽管我的过程没有理由这样做。
Although maybe not best practice, I simply set the text of the XML message to the incoming XML.
Another solution would've been to do an XML translation and store these into variables. Although my process had no reason to.