Skip to Content

Convert one filed to base64binary (byte)

I have a file to webservice scenario in which all fileds that are input to the webservice are string so I map them from the source side after applyign graphical functions.. but one field in target side has a data type base64Binary

Is this same as byte? or this is base64ecoding?

Also can you please let me know I can accomplish the mapping usign UDF?

when I do a return inputstring.getBytes() , its throwing an error

Regards,

Tej

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Aug 11, 2014 at 06:37 AM

    HI Ravi,

    Is this same as byte? or this is base64ecoding?

    This represents an encoding of a binary file, but the representation is in base64. With base64 you can get text or binary data but the algorithm is the same. It is base64encoding

    Also can you please let me know I can accomplish the mapping usign UDF?

    I think that you want to take the file a converting it in base64 and to set a XML tag with this value.

    You can use a java mapping to do this. You use the file adapter to take the file and later in the java mapping you do the base64 conversion:

    1. To read a file and to deal with it in java mapping: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b?QuickLink=index&…

    2. Conversion to base64 of an inputstream: How do you convert an InputStream to a base64 string in Scala? - Stack Overflow

    3. Finally, you take this result and string and you converts the target XML manually.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 11, 2014 at 08:32 AM

    Hi,

    You can convert the base64Binary into string as below:

    byte[] encodedString = Base64.encodeBase64(strInput.getBytes());

    return (encodedString.toString());

    Thanks,

    Kanda

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 13, 2014 at 11:55 AM

    Hi EXperts,

    Any help on this?

    Converting one field of input from string to byte stream?

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 14, 2014 at 05:04 AM

    Hello Experts,

    need help with Strign to byte in udf .. pls let em know

    Add comment
    10|10000 characters needed characters exceeded