[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] is there an example showing how to send an XML document via pub/sub system?

Gautam Thaker schrieb:
Marcel Ruff wrote:
Hi Gautam,

an XML is a byte[]. If you do a

       byte[] bytes = ...
       try {
           String xml = new String(bytes, "UTF-8");
       } catch (UnsupportedEncodingException e) {

you have assumed it is UTF-8 encoded (which is the xml default and is advisable).

But usually you shouldn't do that.
If you use a xml parser for the XML InputStream (from byte[])
it correctly detects the encoding of the xml by looking at the XML header

 <?xml version="1.0" encoding="UTF-8"?>

To summarize: A byte[] is a perfect transport medium for xml,

Hi Marcel:

Many thanks for this clarification. Makes sense. However, this brings me to another (possibly very naive) question. *IF* one is passing around byte [] as message contents, what would be criteria that might make one decide if the protocol to be used should be socket, or xmlrpc, or CORBA, or RMI? Are firewall/security considerations the primary drivers or is it something else?
The protocol choosen is independend of the message content.
Just use SOCKET (with or without SSL) all the time.
In some cases, you may want to choose XML-RPC because of firewall issues.

If you want to integrate a client written in another language (like Ada, Ruby) you can choose the protocol
which is most easy to implement for your client,





Gautam Thaker schrieb:

I am learning more about xmlBlaster by trying various demo programs and running small variations there off. I have run most of the "HelloWorldx.java" pgms and a few others. What I have found so far is that in all cases the content of the user information being sent is a byte array. The key and qos info are in XML, but the user payload is byte array. What I wish to do is to have my payload be a large XML document. (The receiver would have a schema against which it may check for validity before accepting/processing the message.)

Is there an example that shows how this is done? Or is it that in all cases the message content is byte array and all XML documents are simply byte arrays any way? (I am not an XML guru myself, sorry if this is a naive question over all.)


Marcel Ruff
Phone: +49 7551 309371