[MOBY-dev] Binary data streaming
Dmitry Repchevsky
dmitry.repchevski at bsc.es
Thu Jul 31 09:10:08 UTC 2008
Hello everybody,
Last INB meeting in Valencia we were agreed the the correct way to
implement streaming would be using XOP/MTOM specifications.
Even there is no any concrete document or agreement I was played with it
and IMO the easiest way to introduce it in Moby is through a new
primitive type,
something like "Binary". I implemented it in my package and it's very
easy to do using JAXB.
The schema for such an element is:
*****************************************
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:tns="http://www.biomoby.org/moby"
xmlns="http://www.biomoby.org/moby"
xmlns:moby="http://www.biomoby.org/moby"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
version="1.0" targetNamespace="http://www.biomoby.org/moby">
<xs:element name="Binary" type="mobyBinary"></xs:element>
<xs:complexType name="mobyBinary">
<xs:simpleContent>
<xs:extension base="xs:base64Binary"
ns1:expectedContentTypes="application/octet-stream"
xmlns:ns1="http://www.w3.org/2005/05/xmlmime">
... moby attributes
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
*****************************************
Such a binary type will be encoded as base64 if there is no MTOM support
and as a MIME attachment (streamed) otherwise.
Here are both examples of encoding (with and without XOP/MTOM) support:
*****************************************
...
<ns1:Simple articleName="binary"><ns1:Binary id=""
namespace="">dGVzdA==</ns1:Binary></ns1:Simple>
...
*****************************************
--uuid:0895f30d-7b88-411f-94a8-172a5187c9f7
Content-Id:
<rootpart*0895f30d-7b88-411f-94a8-172a5187c9f7 at example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
...
<ns2:Simple articleName="binary">
<ns2:Binary namespace="" id="">
<Include xmlns="http://www.w3.org/2004/08/xop/include"
href="cid:f0b18e0c-df1a-4c77-a6e8-7381ddaa72a6 at example.jaxws.sun.com"/>
</ns2:Binary>
</ns2:Simple>
...
--uuid:0895f30d-7b88-411f-94a8-172a5187c9f7
Content-Id: <f0b18e0c-df1a-4c77-a6e8-7381ddaa72a6 at example.jaxws.sun.com>
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
test
--uuid:0895f30d-7b88-411f-94a8-172a5187c9f7--
*****************************************
This way a PERL implementation (which could face a problem with MTOM
implementation) would use the first form and a Java one, the second...
Looking forward for comments,
Dmitry
More information about the MOBY-dev
mailing list