开发者

Java web service client not decoding base64

开发者 https://www.devze.com 2023-04-09 23:06 出处:网络
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 bel

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 j开发者_高级运维ava side, all I get is an object of class B.

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

Thanks


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;


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

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

精彩评论

暂无评论...
验证码 换一张
取 消