This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Binary Data type in wsdl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Binary Data type in wsdl" Watch "Binary Data type in wsdl" New topic
Author

Binary Data type in wsdl

sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi,
I am using Document/Literal Style in J2EE 1.4 container. I want to send the binary data through webservices. I want to know what is the binary data type i need to use in java/wsdl. I used the data type java.sql.Blob but it failed. Any help is appreciated on this.
Thanks
Sudha
Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
Hi Sudha,

Logically HTTP is a text base protocol so you can't send the binary data,but this binary data is converted using base64 and treat is as string.It increase the size by 30%. You can send binary data using MTOM You need to define the base64 data type in your xsd file and underline binding will convert the binary data to string.

FYI - SOAP Messages with Attachments

Regards
Vijay
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Vijay,
In Webservice code, used the following

byte[] data;

and generated the wsdl. The following element is generated in wsdl:

<element name="data" type="xsd:base64Binary"/>

Is this correct?

Or do i need to use String data;

Thanks
Sudha
Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
Hi Sudha,

It seems correct , you can create your web service according to last post

--Vijay
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Binary Data type in wsdl
 
Similar Threads
Binary File in the Soap Interface
MTOM content transfer - Axis2
what kind of values we can put into timestamo field in sql server and how?
what type should I use ? long Binary ??
Downloading a file from an FTP