Both XML-RPC and SOAP both support transporting binary data using
You can use Apache's XML-RPC implementation found here:
You'll be interested in the org.apache.xmlrpc.Base64 class.
Apache's SOAP implementation can be found here:
You'll be interested in the org.apache.axis.encoding.Base64 class.
Additionally, the XML Schema encoding specifies two other binary
base64Binary (Base64-encoded binary data)
hexBinary (hexadecimal-encoded binary data)
Apache has a custom class for supporting the primitive XSD data type
hexBinary called org.apache.axis.types.HexBinary.
The Apache projects are open source so you can take out optional
classes to meet the requirements of your embedded environment.
SOAP with Attachments (SwA) is another option but you will have to
use SwA APIs or the JavaMail APIs. The JavaMail APIs require the
JavaBeans Activation Framework package so for both of those packages
you are looking at about a 350 KB footprint.
J2ME does not provide a SOAP implementation. However, there are a
lot of open source SOAP implementations for Java that you could
possibly port to J2ME, but to save you the headache there are
already XML-RPC and SOAP implementation for J2ME from Enhydra.
Enhydra has an XML-RPC API for J2ME found here:
The org.kobjects.base64 package provides support for Base64 encoding
of byte arrays.
Enhydra has a SOAP API for J2ME called kSOAP which you can find
There is a Base64 (de)serializer class called
kSOAP does not support SwA so if you really want SwA, you can
combine kSOAP with JavaMail or some other mail attachment API
available for J2ME. I heard Nextel has one but I can't seem to find
it. There is a commercial product that offers it here:
XML, SOAP and Binary Data -
Transporting Binary Data in SOAP -
JavaMail - http://java.sun.com/products/javamail/
--- In firstname.lastname@example.org, "Gaurav" <grana_13@y...> wrote:
> I am working on the J2ME platform on an embedded device
> may need to provide certain Web services. My requirement is that
> need to marshall the data in XML format. But the glitch is that
> data I will sending will be a Binary payload. Now is SOAP better
> such an implemetation or XML-RPC. I believe XML-RPC does not allow
> you to send data as a binary, whereas in SOAP I could send it as
> Please let me know.
> Also does J2ME provide SOAP????????? I know Sun is working on JSR-
> (XML-RPC) but the completion date seems far away.
> Please help me out.
> Thanks in Advance!