gpt4 book ai didi

java - fatal error : 'com.ibm.xtq.commons.utils.wrappedruntimeexception : the root element is required ina well formed document'

转载 作者:太空宇宙 更新时间:2023-11-04 12:04:50 25 4
gpt4 key购买 nike

我正在尝试使用带有 TextMessage 的独立 JMS 应用程序(使用 XML 格式的 Siebel 消息)来运行测试应用程序。我们正在使用特定于 IBM WebSphere MQ 的产品。

我得到了 QueueConnection、QueueSession 和 QueueSender 对象。

我在下面附上了示例代码。运行时,replymessage 为 null,并且出现异常“ fatal error :'com.ibm.xtq.commons.utils.wrappedruntimeException:格式良好的文档中需要根元素'”。
行“TextMessagereplyMessage = (TextMessage)msg”中发生异常为什么我会遇到此异常,请帮助我解决此问题。

public static void main(String args[]){

MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setQueueManager(queueManagerName);
factory.setHostName("hostName");
factory.setTransportType(1);
factory.setPort(1111);
factory.setChannel("channel");
connection = factory.createQueueConnection();
connection.start();
boolean transacted = false;
QueueSession session = connection.createQueueSession(transacted, 1);
MQQueue requestQueue = new MQQueue();
requestQueue.setBaseQueueManagerName(queueManagerName);
requestQueue.setBaseQueueName(requestQueueName);
requestQueue.setTargetClient(1);
Queue replyQueue = session.createQueue(replyQueueName);
QueueSender queueSender = session.createSender(requestQueue);

TextMessage requestMessage = session.createTextMessage();
requestMessage.setText(message);
requestMessage.setJMSReplyTo(replyQueue);
queueSender.send(requestMessage);

String selector = "JMSCorrelationID = '" + id + "'";
javax.jms.QueueReceiver queueReceiver = session.createReceiver(replyQueue, selector);
Message msg = queueReceiver.receive(timeout);

TextMessage replyMessage = (TextMessage)msg;

replyMessage.getText();




}

下面的XML内容是siebel xml请求(该数据是通过JMS发送消息发送的)

<?xml version='1.0' encoding='UTF-8' ?>
<?Siebel-Property-Set EscapeNames='false'?>
<SiebelMessage MessageId='1-1GGX' MessageType='Integration Object' IntObjectName='GL IVR Request' IntObjectFormat='Siebel Hierarchical'>
<GLIVRRequest>
<TransactionName>Policy</TransactionName>
<PolicyNumber>XYZ123</PolicyNumber>
<AgentCode></AgentCode>
<PostalCode></PostalCode>
<WithdrawalAmount></WithdrawalAmount>
<LoanAmount></LoanAmount>
<ApplyToPremium></ApplyToPremium>
<ApplyToPremiumAmount></ApplyToPremiumAmount>
<RequestType></RequestType>
<RequestItemID></RequestItemID>
<SendMethod></SendMethod>
<GLIMCallerFaxNumber></GLIMCallerFaxNumber>
</GLIVRRequest>
</SiebelMessage>

最佳答案

xml 文件为空或 null 时,会发生此类异常。请检查 xml 文件对象。这不是 siebel 格式 xml 问题。

但是,如果您收到的响应为“null”,请检查接收器部分。

关于java - fatal error : 'com.ibm.xtq.commons.utils.wrappedruntimeexception : the root element is required ina well formed document' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40488999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com