You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Marc Schmidt <ma...@1und1.com> on 2004/08/11 15:44:11 UTC
How to send binaries as base64?
Hi All.
To keep it short.
I want to send an array of binaries from a java app to a soap server
using
axis.
Here the part of the wsdl:
<complexType name="ArrayOf_xsd_base64Binary">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:base64Binary[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="PictureContainer">
<sequence>
<element name="allPages" nillable="true"
type="impl:ArrayOf_xsd_base64Binary"/>
</sequence>
</complexType>
Through the axis.wsdl compiler it mapps perfectly to byte[][].
But the xml-output eventually evolving looks like this:
<multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:STGPictureContainerVO" xmlns:ns3="http://bla"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<allPages xsi:type="soapenc:Array" soapenc:arrayType="xsd:byte[][1]">
<item soapenc:arrayType="xsd:byte[15072]">
<item>0</item>
<item>0</item>
<item>-125</item>
<item>48</item>
...
I do not expect each and every single byte to be tagged. I would rather
like to see
something like a stream:
<allPages xsi:type="soapenc:Array"
soapenc:arrayType="xsd:base64Binary[1]">
<item xsi:type="xsd:base64Binary">
lGODdhwAb7CJAAAP///wAAACwAAAAAwAb7CAAC/4SPqcvtD6OctNqLs968
</item>
</allPages>
How do I get there? I cannot attach the binaries using MIME. They
unfortunately need
to be encoded base64 and contained in the soap envelope.
Help of any type is appreciated.
Cheers
Re: How to send binaries as base64?
Posted by Anand Natrajan <an...@cs.virginia.edu>.
Marc,
I had a similar problem, but some details are different. In my case, I had
to send a single binary, not an array of them. Also, I was retrieving the
binary from the server, not sending them to the server.
When I exposed the operation within a doc/lit service, I saw exactly what
you see - each byte gets its own tag, bloating the returned results.
When I exposed the operation within an rpc/enc service, I saw exactly what
you want - data gets base64-encoded within the SOAP response.
On looking through the WSDLs for both cases, I saw that in the doc/lit case,
the return value was essentially "sequence of bytes", but for the rpc/enc
case, it was "base64binary". Perhaps that accounts for the differences.
Hope that helps.
Anand
On Wed, 11 Aug 2004, Marc Schmidt wrote:
: Hi All.
:
: To keep it short.
:
: I want to send an array of binaries from a java app to a soap server
: using
: axis.
:
: Here the part of the wsdl:
:
: <complexType name="ArrayOf_xsd_base64Binary">
: <complexContent>
: <restriction base="soapenc:Array">
: <attribute ref="soapenc:arrayType"
: wsdl:arrayType="xsd:base64Binary[]"/>
: </restriction>
: </complexContent>
: </complexType>
: <complexType name="PictureContainer">
: <sequence>
: <element name="allPages" nillable="true"
: type="impl:ArrayOf_xsd_base64Binary"/>
: </sequence>
: </complexType>
:
: Through the axis.wsdl compiler it mapps perfectly to byte[][].
:
: But the xml-output eventually evolving looks like this:
:
: <multiRef id="id1" soapenc:root="0"
: soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
: xsi:type="ns3:STGPictureContainerVO" xmlns:ns3="http://bla"
: xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
: <allPages xsi:type="soapenc:Array" soapenc:arrayType="xsd:byte[][1]">
: <item soapenc:arrayType="xsd:byte[15072]">
: <item>0</item>
: <item>0</item>
: <item>-125</item>
: <item>48</item>
: ...
:
: I do not expect each and every single byte to be tagged. I would rather
: like to see
: something like a stream:
: <allPages xsi:type="soapenc:Array"
: soapenc:arrayType="xsd:base64Binary[1]">
: <item xsi:type="xsd:base64Binary">
:
: lGODdhwAb7CJAAAP///wAAACwAAAAAwAb7CAAC/4SPqcvtD6OctNqLs968
: </item>
: </allPages>
:
: How do I get there? I cannot attach the binaries using MIME. They
: unfortunately need
: to be encoded base64 and contained in the soap envelope.
:
: Help of any type is appreciated.
:
: Cheers
:
:
:
:
:
: