Jump to content

From Java Code to Tibco Ems getting error org.xml.sax.SAXException: validation error: unexpected content


Manoj Chaurasia

Recommended Posts

I am creating a java program where I am sending a ems message to Tibco Ems.http://

 

When I send a message to ems queue I am getting the following attached error. Please see the attachment.

 

Below is my java code :

 

QueueConnectionFactory factory = new com.tibco.tibjms.TibjmsQueueConnectionFactory(serverUrl);

QueueConnection connection = factory.createQueueConnection(userName, password);

QueueSession session = connection.createQueueSession(false,javax.jms.Session.AUTO_ACKNOWLEDGE);

TibjmsQueue queue = (TibjmsQueue) session.createQueue(queueName);

QueueSender sender = session.createSender(queue);

for (int i = 0; i < data.size(); i++) {

javax.jms.TextMessage message = session.createTextMessage();

String text = (String) data.elementAt(i);

message.setStringProperty("Service", Service);

message.setStringProperty("Method", Method);

message.setStringProperty("Version", Version);

message.setStringProperty("Culture", Culture);

message.setStringProperty("Timestamp", timeStamp);

message.setStringProperty("SystemUsername", SystemUsername);

message.setStringProperty("SystemPassword", SystemPassword);

message.setStringProperty("LineOfBusiness", LineOfBusiness);

message.setStringProperty("Application", Application);

message.setStringProperty("Client", TibjmsQueueSender.Client);

message.setStringProperty("Channel", TibjmsQueueSender.Channel);

message.setText(getContents(text));

sender.send(message);

System.err.println("Sent message: " + message);

}

 

When I send the message the header fields are getting re organized as below

 

Sent message: TextMessage={ Header={ JMSMessageID={ID:EMSServer.71DC4BD8614123D2F8:1} JMSDestination={Queue[Asurion.Dev.DocumentManagement.ProcessDispositionDocuments.Request]} JMSReplyTo= JMSDeliveryMode= JMSRedelivered= JMSCorrelationID= JMSType= JMSTimestamp={Tue Aug 10 12:04:38 CDT 2010} JMSExpiration= JMSPriority= } Properties={ Culture={String:en-US} Service= Channel= Method= Application= SystemPassword= SystemUsername= Version= Client= LineOfBusiness= Timestamp= } Text={...}

 

And on Ems queue I am getting the following error

at com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)

caused by: org.xml.sax.SAXException: validation error: unexpected content "SystemUsername"; expected "TimeStamp" ({com.tibco.xml.validation}COMPLEX_E_UNEXPECTED_CONTE

NT) at /jms1:ActivityOutput[1]/OtherProperties[1]/SystemUsername[1]

com.tibco.xml.validation.exception.d: unexpected content "SystemUsername"; expected "TimeStamp"

 

Any1 knows what I am doing wrong in this case.

Link to comment
Share on other sites

  • 8 years later...

I may be late to answer this, but the inout that you shared has a missing filed of timestamp and that is what the error is trying to say.

Your input expects value of 'Timestamp' after 'Culture' , instead you have given 'Username'skipping timestamp value hence the error.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...