Using base64Binary instead of hexBinary for binary fields - when and why?

View: New views
3 Messages — Rating Filter:   Alert me  

Using base64Binary instead of hexBinary for binary fields - when and why?

by Ellecer Valencia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've been working on a web service that will be receiving binary
files, and I've been researching MTOM. Most of the documents I've seen
state that in the WSDL, your binary field should be of type
xs:base64Binary or xs:hexBinary, and that either of these two will
result in a byte[] when the proxy classes are generated.

What is still unclear to me is when you should use hexBinary over
base64Binary. Most sample code I've seen actually uses hex64Binary. In
what scenarios should you use one over the other?


thanks,

Ellecer

Re: Using base64Binary instead of hexBinary for binary fields - when and why?

by DSosnoski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ellecer,

Schema is a mish-mash of features, many of which do not make any sense.
xs:hexBinary is pretty much in this category. It's always going to be
bulkier than xs:base64Binary, and has no compensating advantages. Just
ignore it, and always use xs:base64Binary - that way, in cases where
MTOM is not active you'll still have a reasonably compact format.

  - Dennis

--
Dennis M. Sosnoski
Java XML and Web Services
Axis2 Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Ellecer Valencia wrote:

> Hi,
>
> I've been working on a web service that will be receiving binary
> files, and I've been researching MTOM. Most of the documents I've seen
> state that in the WSDL, your binary field should be of type
> xs:base64Binary or xs:hexBinary, and that either of these two will
> result in a byte[] when the proxy classes are generated.
>
> What is still unclear to me is when you should use hexBinary over
> base64Binary. Most sample code I've seen actually uses hex64Binary. In
> what scenarios should you use one over the other?
>
>
> thanks,
>
> Ellecer
>  

Re: Using base64Binary instead of hexBinary for binary fields - when and why?

by Ellecer Valencia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Dennis!

On Tue, Nov 3, 2009 at 6:11 PM, Dennis Sosnoski <dms@...> wrote:

> Hi Ellecer,
>
> Schema is a mish-mash of features, many of which do not make any sense.
> xs:hexBinary is pretty much in this category. It's always going to be
> bulkier than xs:base64Binary, and has no compensating advantages. Just
> ignore it, and always use xs:base64Binary - that way, in cases where MTOM is
> not active you'll still have a reasonably compact format.
>
>  - Dennis
>
> --
> Dennis M. Sosnoski
> Java XML and Web Services
> Axis2 Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
> Ellecer Valencia wrote:
>>
>> Hi,
>>
>> I've been working on a web service that will be receiving binary
>> files, and I've been researching MTOM. Most of the documents I've seen
>> state that in the WSDL, your binary field should be of type
>> xs:base64Binary or xs:hexBinary, and that either of these two will
>> result in a byte[] when the proxy classes are generated.
>>
>> What is still unclear to me is when you should use hexBinary over
>> base64Binary. Most sample code I've seen actually uses hex64Binary. In
>> what scenarios should you use one over the other?
>>
>>
>> thanks,
>>
>> Ellecer
>>
>