简体   繁体   中英

Java web service client not decoding base64

I'm currently trying to implement a WS client in java but I have the following problem:

The server is running in IIS 7.5 and was implemented with c#. It is sending a base64Binary string (which I believe it is supposed to since the original data was a byte array) but on the java side, all I get is an object of class B.

How can I get a byte array back from that object?

Thanks

Do you mean Class [B ? In that case all you need is to cast:

byte[] bytes = (byte[]) obj;

It sounds like you have a object of type array of byte (byte[])

System.out.println("class=" + byte[].getClass());
System.out.println("class=" + byte[].getClass().getName());

produces an output of

class=class [B
class=[B

If this matches your output, then just cast the object into a byte[]

(byte[]) array;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM