You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Marco Schulze <Ma...@NightLabs.com> on 2002/12/04 02:25:36 UTC

binary data in SOAP

Hello,

how is it possible to serialize binary data (e.g. FileStreams) via SOAP? 
I saw a MIMEPartSerializer. Does this encode like binary data in an 
eMail is encoded? This would be bad, because it gets much bigger by 
this. Is it possible to serialize somehow with raw binary data? Does the 
BeanSerializer automatically does encode streams (e.g. an image in a 
FileInputStream)?

I hope that I could make understandable what I mean...

Thanks in advance for answers!

Best regards, Marco ;-)




Re: binary data in SOAP

Posted by Scott Nichol <sn...@scottnichol.com>.
The XML declaration typically includes an encoding attribute, e.g.

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

All of the XML data that follows, including stuff in CDATA, will be
interpretted using that encoding.  The parser cannot "ignore" stuff
within CDATA: it must interpret it, if only to find out when the CDATA
ends!.

Scott Nichol

----- Original Message -----
From: "Pae Choi" <pa...@earthlink.net>
To: <so...@xml.apache.org>
Sent: Wednesday, December 04, 2002 6:44 PM
Subject: Re: binary data in SOAP


> Base64ing makes sense. What about the CDATA section to
> contain the binary data? It says about the "character data",
> but the parser should skip the content of the section. I
> haven't try that yet though.
>
> Does any try that before? Any comments?
>
>
> Pae
>
>
>
>
> > You do not send arbitrary binary data as XML.  XML is "readable",
i.e.
> > it is character based.  The typical encoding used is utf-8, which
would
> > not allow you to send arbitrary binary data.  It is typical to
base64
> > encode binary data, which increases its size 33%.  Welcome to XML,
which
> > you can generally assume will be the worst-case serialization method
in
> > terms of size and speed.  For size and speed, you might just use the
> > serialization built into Java.
> >
> > The MIMEPartSerializer is for attachments.  It will typically base64
> > encode binary data.  The attachments are not part of the XML itself,
so
> > if you really want to carry XML payloads, you cannot use this.
> >
> > Scott Nichol
> >
> > ----- Original Message -----
> > From: "Marco Schulze" <Ma...@NightLabs.com>
> > To: <so...@xml.apache.org>
> > Sent: Tuesday, December 03, 2002 8:25 PM
> > Subject: binary data in SOAP
> >
> >
> > > Hello,
> > >
> > > how is it possible to serialize binary data (e.g. FileStreams) via
> > SOAP?
> > > I saw a MIMEPartSerializer. Does this encode like binary data in
an
> > > eMail is encoded? This would be bad, because it gets much bigger
by
> > > this. Is it possible to serialize somehow with raw binary data?
Does
> > the
> > > BeanSerializer automatically does encode streams (e.g. an image in
a
> > > FileInputStream)?
> > >
> > > I hope that I could make understandable what I mean...
> > >
> > > Thanks in advance for answers!
> > >
> > > Best regards, Marco ;-)
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@xml.apache.org>
> > > For additional commands, e-mail:
> > <ma...@xml.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@xml.apache.org>
> > For additional commands, e-mail:
<ma...@xml.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>


Re: binary data in SOAP

Posted by Scott Nichol <sn...@scottnichol.com>.
The XML declaration typically includes an encoding attribute, e.g.

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

All of the XML data that follows, including stuff in CDATA, will be
interpretted using that encoding.  The parser cannot "ignore" stuff
within CDATA: it must interpret it, if only to find out when the CDATA
ends!.

Scott Nichol

----- Original Message -----
From: "Pae Choi" <pa...@earthlink.net>
To: <so...@xml.apache.org>
Sent: Wednesday, December 04, 2002 6:44 PM
Subject: Re: binary data in SOAP


> Base64ing makes sense. What about the CDATA section to
> contain the binary data? It says about the "character data",
> but the parser should skip the content of the section. I
> haven't try that yet though.
>
> Does any try that before? Any comments?
>
>
> Pae
>
>
>
>
> > You do not send arbitrary binary data as XML.  XML is "readable",
i.e.
> > it is character based.  The typical encoding used is utf-8, which
would
> > not allow you to send arbitrary binary data.  It is typical to
base64
> > encode binary data, which increases its size 33%.  Welcome to XML,
which
> > you can generally assume will be the worst-case serialization method
in
> > terms of size and speed.  For size and speed, you might just use the
> > serialization built into Java.
> >
> > The MIMEPartSerializer is for attachments.  It will typically base64
> > encode binary data.  The attachments are not part of the XML itself,
so
> > if you really want to carry XML payloads, you cannot use this.
> >
> > Scott Nichol
> >
> > ----- Original Message -----
> > From: "Marco Schulze" <Ma...@NightLabs.com>
> > To: <so...@xml.apache.org>
> > Sent: Tuesday, December 03, 2002 8:25 PM
> > Subject: binary data in SOAP
> >
> >
> > > Hello,
> > >
> > > how is it possible to serialize binary data (e.g. FileStreams) via
> > SOAP?
> > > I saw a MIMEPartSerializer. Does this encode like binary data in
an
> > > eMail is encoded? This would be bad, because it gets much bigger
by
> > > this. Is it possible to serialize somehow with raw binary data?
Does
> > the
> > > BeanSerializer automatically does encode streams (e.g. an image in
a
> > > FileInputStream)?
> > >
> > > I hope that I could make understandable what I mean...
> > >
> > > Thanks in advance for answers!
> > >
> > > Best regards, Marco ;-)
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@xml.apache.org>
> > > For additional commands, e-mail:
> > <ma...@xml.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@xml.apache.org>
> > For additional commands, e-mail:
<ma...@xml.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>


Re: binary data in SOAP

Posted by Pae Choi <pa...@earthlink.net>.
Base64ing makes sense. What about the CDATA section to
contain the binary data? It says about the "character data",
but the parser should skip the content of the section. I
haven't try that yet though.

Does any try that before? Any comments?


Pae




> You do not send arbitrary binary data as XML.  XML is "readable", i.e.
> it is character based.  The typical encoding used is utf-8, which would
> not allow you to send arbitrary binary data.  It is typical to base64
> encode binary data, which increases its size 33%.  Welcome to XML, which
> you can generally assume will be the worst-case serialization method in
> terms of size and speed.  For size and speed, you might just use the
> serialization built into Java.
> 
> The MIMEPartSerializer is for attachments.  It will typically base64
> encode binary data.  The attachments are not part of the XML itself, so
> if you really want to carry XML payloads, you cannot use this.
> 
> Scott Nichol
> 
> ----- Original Message -----
> From: "Marco Schulze" <Ma...@NightLabs.com>
> To: <so...@xml.apache.org>
> Sent: Tuesday, December 03, 2002 8:25 PM
> Subject: binary data in SOAP
> 
> 
> > Hello,
> >
> > how is it possible to serialize binary data (e.g. FileStreams) via
> SOAP?
> > I saw a MIMEPartSerializer. Does this encode like binary data in an
> > eMail is encoded? This would be bad, because it gets much bigger by
> > this. Is it possible to serialize somehow with raw binary data? Does
> the
> > BeanSerializer automatically does encode streams (e.g. an image in a
> > FileInputStream)?
> >
> > I hope that I could make understandable what I mean...
> >
> > Thanks in advance for answers!
> >
> > Best regards, Marco ;-)
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@xml.apache.org>
> > For additional commands, e-mail:
> <ma...@xml.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 


Re: binary data in SOAP

Posted by Pae Choi <pa...@earthlink.net>.
Base64ing makes sense. What about the CDATA section to
contain the binary data? It says about the "character data",
but the parser should skip the content of the section. I
haven't try that yet though.

Does any try that before? Any comments?


Pae




> You do not send arbitrary binary data as XML.  XML is "readable", i.e.
> it is character based.  The typical encoding used is utf-8, which would
> not allow you to send arbitrary binary data.  It is typical to base64
> encode binary data, which increases its size 33%.  Welcome to XML, which
> you can generally assume will be the worst-case serialization method in
> terms of size and speed.  For size and speed, you might just use the
> serialization built into Java.
> 
> The MIMEPartSerializer is for attachments.  It will typically base64
> encode binary data.  The attachments are not part of the XML itself, so
> if you really want to carry XML payloads, you cannot use this.
> 
> Scott Nichol
> 
> ----- Original Message -----
> From: "Marco Schulze" <Ma...@NightLabs.com>
> To: <so...@xml.apache.org>
> Sent: Tuesday, December 03, 2002 8:25 PM
> Subject: binary data in SOAP
> 
> 
> > Hello,
> >
> > how is it possible to serialize binary data (e.g. FileStreams) via
> SOAP?
> > I saw a MIMEPartSerializer. Does this encode like binary data in an
> > eMail is encoded? This would be bad, because it gets much bigger by
> > this. Is it possible to serialize somehow with raw binary data? Does
> the
> > BeanSerializer automatically does encode streams (e.g. an image in a
> > FileInputStream)?
> >
> > I hope that I could make understandable what I mean...
> >
> > Thanks in advance for answers!
> >
> > Best regards, Marco ;-)
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@xml.apache.org>
> > For additional commands, e-mail:
> <ma...@xml.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 


Re: binary data in SOAP

Posted by Marco Schulze <Ma...@NightLabs.com>.
Scott Nichol wrote:

>You do not send arbitrary binary data as XML.  XML is "readable", i.e.
>it is character based.  The typical encoding used is utf-8, which would
>not allow you to send arbitrary binary data.  It is typical to base64
>encode binary data, which increases its size 33%.  Welcome to XML, which
>you can generally assume will be the worst-case serialization method in
>terms of size and speed.  For size and speed, you might just use the
>serialization built into Java.
>
>The MIMEPartSerializer is for attachments.  It will typically base64
>encode binary data.  The attachments are not part of the XML itself, so
>if you really want to carry XML payloads, you cannot use this.
>
>Scott Nichol
>

Hello Scott,

thanks for your very quick response!

No problem! Our protocol supports raw binary transfers and all XML is 
automatically zipped. Thus, this will not really be a problem. I think, 
in this case, we will use our own mechanism for binaries and use 
XML-serialization only for "small" data (no blobs).

I found my way through Castor (at least most of it) and was able to 
serialize to a file and to deserialize from it. It worked!!! Thus, 
thanks again for this tip. This means, I could continue now on my main 
task, but I really would like to be able to support SOAP, too, if it is 
not too hard to do that.

Best regards, Marco ;-)



Re: binary data in SOAP

Posted by Marco Schulze <Ma...@NightLabs.com>.
Scott Nichol wrote:

>You do not send arbitrary binary data as XML.  XML is "readable", i.e.
>it is character based.  The typical encoding used is utf-8, which would
>not allow you to send arbitrary binary data.  It is typical to base64
>encode binary data, which increases its size 33%.  Welcome to XML, which
>you can generally assume will be the worst-case serialization method in
>terms of size and speed.  For size and speed, you might just use the
>serialization built into Java.
>
>The MIMEPartSerializer is for attachments.  It will typically base64
>encode binary data.  The attachments are not part of the XML itself, so
>if you really want to carry XML payloads, you cannot use this.
>
>Scott Nichol
>

Hello Scott,

thanks for your very quick response!

No problem! Our protocol supports raw binary transfers and all XML is 
automatically zipped. Thus, this will not really be a problem. I think, 
in this case, we will use our own mechanism for binaries and use 
XML-serialization only for "small" data (no blobs).

I found my way through Castor (at least most of it) and was able to 
serialize to a file and to deserialize from it. It worked!!! Thus, 
thanks again for this tip. This means, I could continue now on my main 
task, but I really would like to be able to support SOAP, too, if it is 
not too hard to do that.

Best regards, Marco ;-)



Re: binary data in SOAP

Posted by Scott Nichol <sn...@scottnichol.com>.
You do not send arbitrary binary data as XML.  XML is "readable", i.e.
it is character based.  The typical encoding used is utf-8, which would
not allow you to send arbitrary binary data.  It is typical to base64
encode binary data, which increases its size 33%.  Welcome to XML, which
you can generally assume will be the worst-case serialization method in
terms of size and speed.  For size and speed, you might just use the
serialization built into Java.

The MIMEPartSerializer is for attachments.  It will typically base64
encode binary data.  The attachments are not part of the XML itself, so
if you really want to carry XML payloads, you cannot use this.

Scott Nichol

----- Original Message -----
From: "Marco Schulze" <Ma...@NightLabs.com>
To: <so...@xml.apache.org>
Sent: Tuesday, December 03, 2002 8:25 PM
Subject: binary data in SOAP


> Hello,
>
> how is it possible to serialize binary data (e.g. FileStreams) via
SOAP?
> I saw a MIMEPartSerializer. Does this encode like binary data in an
> eMail is encoded? This would be bad, because it gets much bigger by
> this. Is it possible to serialize somehow with raw binary data? Does
the
> BeanSerializer automatically does encode streams (e.g. an image in a
> FileInputStream)?
>
> I hope that I could make understandable what I mean...
>
> Thanks in advance for answers!
>
> Best regards, Marco ;-)
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>


Re: binary data in SOAP

Posted by Scott Nichol <sn...@scottnichol.com>.
You do not send arbitrary binary data as XML.  XML is "readable", i.e.
it is character based.  The typical encoding used is utf-8, which would
not allow you to send arbitrary binary data.  It is typical to base64
encode binary data, which increases its size 33%.  Welcome to XML, which
you can generally assume will be the worst-case serialization method in
terms of size and speed.  For size and speed, you might just use the
serialization built into Java.

The MIMEPartSerializer is for attachments.  It will typically base64
encode binary data.  The attachments are not part of the XML itself, so
if you really want to carry XML payloads, you cannot use this.

Scott Nichol

----- Original Message -----
From: "Marco Schulze" <Ma...@NightLabs.com>
To: <so...@xml.apache.org>
Sent: Tuesday, December 03, 2002 8:25 PM
Subject: binary data in SOAP


> Hello,
>
> how is it possible to serialize binary data (e.g. FileStreams) via
SOAP?
> I saw a MIMEPartSerializer. Does this encode like binary data in an
> eMail is encoded? This would be bad, because it gets much bigger by
> this. Is it possible to serialize somehow with raw binary data? Does
the
> BeanSerializer automatically does encode streams (e.g. an image in a
> FileInputStream)?
>
> I hope that I could make understandable what I mean...
>
> Thanks in advance for answers!
>
> Best regards, Marco ;-)
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>