I am trying to run Test application using standalone JMS application with TextMessage(using Siebel message in XML format). We are using IBM WebSphere MQ specific.
I got QueueConnection, QueueSession and QueueSender objects.
I have attached sample code below. While running, replymessage is null and i got exception "FATAL ERROR: 'com.ibm.xtq.commons.utils.wrappedruntimeexception : the root element is required ina well formed document'".
Exception occured in line "TextMessage replyMessage = (TextMessage)msg"
Why i am getting this exception, help me out to resolve this issue.
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();
}
Below XML content is siebel xml request(this data is sent through JMS send message)
<?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>
These kind of exception occur when xml file is empty or null. Please check the xml file object. This is not siebel format xml issue.
However, if you get response as "null", please check the receiver part.