Data structures of primitives may not work. Try putting your image in an
object.
Hessian serializes all the data being transferred. My understanding is
that aAs primitives don't implement Serializable they are special cases in
hessian and specifically catered for.
There may be better ways others can suggest, but I tend to use objects
just to get around this.
> Using below's scenario, is it possible to send a byte array?
>
> I am able to get the other properties when sending the Person object (name
> and age)
> But when trying to read image attribute with its getter method, I get this
> exception:
>
> java.lang.NoSuchMethodError: Person.getImage()[B
>
> The weird thing is that in the client, after setting the image attribute,
> I can read it. Actually making sure the array of bytes (the image
> attribute) has a length.
>
>
>
> My class Person:
> public class Person implements Serializable{
> private String name;
> private int age;
> private byte[] image;
>
> public int getAge() {
> return age;
> }
> public void setAge(int age) {
> this.age = age;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> public byte[] getImage() {
> return image;
> }
> public void setImage(byte[] image) {
> this.image = image;
> }
> }
>
>
>
> String url = "http://localhost/HessianService/MyService";
>
> HessianProxyFactory factory = new HessianProxyFactory();
>
> MyService my = (MyService) factory.create(MyService.class,
> url);
>
> Person aPerson = new Person();
> aPerson.setAge(20);
> aPerson.setName("aName");
> aPerson.setImage(readImage());
>
> my.sayHi(aPerson);
>
>
> Thanks for your help.
>
> Gabriel
>
> *************************** IMPORTANT
> NOTE***************************** The opinions expressed in this
> message and/or any attachments are those of the author and not
> necessarily those of Brown Brothers Harriman & Co., its
> subsidiaries and affiliates ("BBH"). There is no guarantee that
> this message is either private or confidential, and it may have
> been altered by unauthorized sources without your or our knowledge.
> Nothing in the message is capable or intended to create any legally
> binding obligations on either party and it is not intended to
> provide legal advice. BBH accepts no responsibility for loss or
> damage from its use, including damage from virus.
> ************************************************************************_______________________________________________
> hessian-interest mailing list
> [email protected]
> http://maillist.caucho.com/mailman/listinfo/hessian-interest
>
_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest