Hi I have made a small example to show my problem. Here is my web-service:
package service;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class BytesService {
@WebMethod
public String redirectString(String string){
return string+" - is what you sended";
}
@WebMethod
public byte[] redirectBytes(byte[] bytes) {
System.out.println("### redirectBytes");
System.out.println("### bytes lenght:" + bytes.length);
System.out.println("### message" + new String(bytes));
return bytes;
}
@WebMethod
public byte[] genBytes() {
byte[] bytes = "Hello".getBytes();
return bytes;
}
}
I pack it in jar file and store in "axis2-1.5.1/repository/servicejars" folder. Then I generate client Proxy using Eclipse for EE default utils. And use it in my code in the following way:
BytesService service = new BytesServiceProxy();
System.out.println("Redirect string");
System.out.println(service.redirectString("Hello"));
System.out.println("Redirect bytes");
byte[] param = { (byte)21, (byte)22, (byte)23 };
System.out.println(param.length);
param = service.redirectBytes(param);
System.out.println(param.length);
System.out.println("Gen bytes");
param = service.genBytes();
System.out.println(param.length);
And here is what my client prints:
Redirect string
Hello - is what you sended
Redirect bytes
3
0
Gen bytes
5
And on server I have:
### redirectBytes
### bytes lenght:0
### message
So byte array can normally be transfered from service, but is not accepted from the client. And it works fine with strings. Now I use Base64Encoder, but I dislike this solution.