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

2010-04-13 Thread Marcel Ruff

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) {
   e.printStackTrace();
   }

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


 

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,

Marcel


Thanks.

Gautam



Marcel

Gautam Thaker schrieb:

Hi:

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.)


Gautam










--
Marcel Ruff
http://www.xmlBlaster.org
http://watchee.net
Phone: +49 7551 309371



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

2010-04-13 Thread Gautam Thaker

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) {
   e.printStackTrace();
   }

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

 

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?


Thanks.

Gautam



Marcel

Gautam Thaker schrieb:

Hi:

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.)


Gautam








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

2010-04-07 Thread Marcel Ruff

Hi Gautam,

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

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

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

 

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

Marcel

Gautam Thaker schrieb:

Hi:

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.)


Gautam




--
Marcel Ruff
http://www.xmlBlaster.org
http://watchee.net
Phone: +49 7551 309371



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

2010-04-06 Thread Gautam Thaker

Hi:

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.)


Gautam