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 thiamteck <th...@gmail.com> on 2008/08/07 05:06:10 UTC

Re: Problem with xs:base64Binary

Hi,

I have similar requirement for develop a soap client that send base64binary. 

My use case is that i got to convert some of the sensitive info from string
into base64binary, then send it as inline content instead of attachement.

Matt, do you found the solution of:
>         // Insert miracle here, where myString data is sent
>         // to the dataHandler object and turned into
>         // base64 data.

Thilina, in your ByteArrayDataSource example, do I need to configure
somewhere for the base64binary?

Thank you.:-D

Truly,
Thiam Teck



Thilina Gunarathne wrote:
> 
> First of all I wonder why do you want to send a plain string using
> base64Binary.. Is it a huge string and do you want to send it as an
> attachement?..
> 
> Use org.apache.axiom.attachments.ByteArrayDataSource..
> 		String test = "test";
> 		ByteArrayDataSource dataSource  = new
> ByteArrayDataSource(test.getBytes());
> 		DataHandler dataHandler = new DataHandler(dataSource);
> 
> Other way round,
>          InputStream inputStream = dataHandler.getInputStream();
> Read the content to a byte[].. Create the string from that byte[]...
> 
> thanks,
> Thilina
> 
> 
>>
>>  public DataHandler convertStringToBase64Binary (String myString) {
>>         // Example myString value = "0 23 532 12";
>>
>>         DataHandler myBase64BinaryField;
>>
>>         // Constructor for DataHandler...
>>
>>         // Insert miracle here, where myString data is sent
>>         // to the dataHandler object and turned into
>>         // base64 data.
>>
>>         return myBase64BinaryField;
>>  }
>>
>>  It would be interesting to see the other direction (i.e. DataHandler to
>>  String) as well.
>>
>>  * As I mentioned in my previous message, the easy solution is to just
>> send
>>  the data as an xs:string, which works for me since I'm creating both the
>>  client- and the server-sides of the web service.  That said, I am still
>>  interested in understanding the mechanics of DataHandler.
>>
>>  Thanks again,
>>
>>  Matt Fadoul
>>  My3D, LLC
>>
>>
>>  -----Original Message-----
>>  From: Thilina Gunarathne [mailto:csethil@gmail.com]
>>  Sent: Thursday, February 28, 2008 9:45 AM
>>  To: axis-user@ws.apache.org
>>  Subject: Re: Problem with xs:base64Binary
>>
>>  Hi,
>>  > 2) The code examples that I found for DataHandler generally involve
>> things
>>  > like files, etc.
>>
>> Yep... It can even be a byte[]..  base64Binary data type stands for
>>  base64 encoded binary data.. Hence everything that involves
>>  Datahandlers work in binary(byte) level..
>>
>> > For example:
>>  > http://ws.apache.org/axis2/1_2/mtom-guide.html#21
>>  > (Note: It seems that the lines of code with OMText aren't complete).
>>
>> ouch... Please use the newest version.. It seems to be complete..
>>  http://ws.apache.org/axis2/1_3/mtom-guide.html#21
>>
>>
>> > 3) In my case, my data is much simpler.  For example, if I could
>> populate
>>  > the field with a string (e.g. "0 23 532 12"), that would be
>> sufficient.
>>
>> What's your exact use case.. What are you trying to send in that
>>  field.. Do you already have a base64 encoded string with you??
>>
>>
>> > My quick solution is to just change this field's type to xs:string. 
>> The
>>  > reason I'd like to keep it xs:base64binary is because it's someone
>> else's
>>  > schema, so I wanted to stay faithful to their data types.
>>
>> Please find out what kind of data (semantics) is he expecting, whether
>>  it's image or a signature etc... It's ok to change it to string.. But
>>  you would need to make sure to set the content to a base64 encoded
>>  string of the expected type..
>>
>>  thanks,
>>  Thilina
>>  >
>>
>> > Thanks!
>>  >
>>  > Matt Fadoul
>>  >
>>  > My3D, LLC
>>
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 
> 
> -- 
> Thilina Gunarathne  - http://thilinag.blogspot.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-xs%3Abase64Binary-tp15733036p18863276.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org