How do you format the body of a JMS text message?
Does everyone just use XML in the message? Are there any good alternatives to XML? If you do use XML, do you define an XML Schema so clients know how to send messages to your service?
Asked by: Lenny506 | Posted: 28-01-2022
Answer 1
We use XML, but I think the important thing is to tailor the solution to the problem. The reason we use XML is that we are basically sending an object across in the message. There's no reason it can't be plain text, if applicable for the message you are sending, using headers to send along properties if appropriate.
We haven't defined an XSD or DTD for our XML messages, but we do have a formal document describing their composition so that other teams can use our feeds without bugging us. Answered by: Michelle297 | Posted: 01-03-2022
Answer 2
XML, CSV, HTML, a simple word or sentence, ... Any of these are valid depending on the context in which the message is used and created. Just keep it simple and send what is needed in that context.
It is very flexible and can be adapted to the problem space.
Answered by: Sydney440 | Posted: 01-03-2022Answer 3
XML is probably the most popular along with JSON a close second - but as others have said in this thread - XML, CSV, JSON or even HTML are fine.
XSDs are overrated really - their only real value is if you want your clients/customers to code generate marshalling code (e.g. using JAXB) or if you want to let folks use XSDs in their editors / IDE to get smart completion
Answered by: Dexter901 | Posted: 01-03-2022Similar questions
java - How to I format my log message
I would like to format my log message before being printed out on the console Logger.fine
e.g. How do I format "{0} has {1} apples with him", so the inputs are John and 10
I would prefer a logging framework which provides a solution to this and I don't want to format these mes...
java - GSM Modem Send Message in UCS2 format error
I'm using java to communicate with a gsm modem (Siemens) using AT commands.
I set the encoding of modem to "UCS2".
When sending messages as soon as I send the phone number I get ERROR from the device:
AT+CSCS=UCS2
OK
AT+CSMP=17,167,0,8
OK
AT+CMGF=1
OK
AT+CMGS="0919xxxxxxx"
ERROR
HELP ME, PLEEEEEEASE! :(
java - How to give Error message when user input wrong format of date in Java8
I want to give an error message if the user inputs using the wrong format. The correct format is "yyyy-MM-dd HH:mm:ss". How can I put that as a condition?
for example
if (yyyy <0 )
{ sout("please input correct year")}
this is the code i use for ask the user and formatting it
Scanner keyboard = new Scanner(System.in);
String hour = "00:00:00";
System.out.println("Please e...
Java 11 : RegEx to Parse Log Message to CSV format
I need to parse the logs and print it in csv format as below, so far I was able to extract the timestamp, message and id from the log message but I was having hard time extracting the fields using the regex, can someone please help me parsing the fields such as field_1,field_2,field_3,field_4,field_5,field_6,field_9....... from the input logs.
If the input logs has more fields like field_10
soap - What does this Java error message entail? And how can i fix it?
I get this message when trying to communicate with software that communicates with SOAP?
Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
I am using a third party API to communicate with an Ardome MAM system.
java - How do I test a message queue client?
I am working on a java message queue client (beanstalk) and right now my tests look like this:
//make sure our getJob can handle utf8 characters
@Test
public void testUTF8() {
bean = new Beanstalk();
Job job = new Job();
bean.putJob("€");
job = bean.getJob();
assertEquals("€", job.msg);
bean.close();
}
I've read that you shouldn't test the actual queue itself cause ...
java - How do I get an error message when failing to load a JVM via JNI?
I would like to retrieve an error message that explains why the jvm failed to load. From the examples provided here:
http://java.sun.com/docs/books/jni/html/invoke.html
I extracted this example:
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
if (res <...
java - Log4j for Message Driven Beans
So, here's my problem:
I have a message driven bean X and would like to make use of Logger in X's onMessage() method. Lets presume that I have a single instance of the bean running in my app server, hence, I would initialize log4j in ejbCreate(). This would mean I would have to do something like this:
public void ejbCreate() {
PropertyConfigurator.configure(Classloader.getResourceAsStream("xyz_lo...
java - Missed Socket Message
I have been doing socket programming for many years, but I have never had a missed message using TCP - until now. I have a java server and a client in C - both on the localhost. They are sending short message back and forth as strings, with some delays in between. I have one particular case where a message never arrives on the client side. It is reproducible, but oddly machine dependent.
To give some more de...
java - mobile app auto dial on message from server
How do I autodial a mobile using a j2me app running on it based on a message initiated from a remote server.
The server message could trigger the j2me app to dial a predefined number.
I have figured out that the dialing can be done with the platformRequest() method through which I can send it a phonenumber as a url string.
However I dont know of any protocols where the server side can initiate dialogue with the cli...
java - Need a way to search mail for a message id using imap
I am using Java Mail api to access a gmail account (not fixed).
I need to search all mails for a given Mail id ().
The search should terminate on the FIRST occurence of the message with given ID
(Optimization : only a single mail should exist with the given id)
i would of course would like to skip the "All mail" folder.
The simplest method is to do :
Get Default folder
Get all folders...
Java HTTP post for XML SOAP message
How to expose / publish services using Java HTTP post for XML SOAP message.
What are all steps need to follow.
I did googling but haven't found any thing about exposing / publishing services.
java - Message to a client from the server
I have to design a client/server system emulated on a website running Ruby on Rails that should work like this:
a page is requested by a web browser and once it's opened the server can push messages to it
I know this is not possible "naturally" but I was thinking of a sort of "java applet" that is running on that page, listening on a port for messages to be...
java - JMS Topic message size
Our application uses a topic to push message to a small set of subscribers. what sort of things should i look for when modeling a jms message with respect to the size of the actual message to be pushed. Are there any known limits or is application server specific? Any best practices or suggestions on this topic (pun unintended)?
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)