axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JFeisty <justin.fe...@gmail.com>
Subject Passing 2 byte arrays to web service is yielding strange results
Date Thu, 13 Aug 2009 22:19:35 GMT

Axis newbie here....I have a very simple (pojo) web service and am serving it
using Axis2 v1.5 in Tomcat 6.  I have one web method called test().  It
takes as a parameter a 'Placeholder' object.  That 'Placeholder' object has
two private byte array fields exposed with getters and setters.  Here is the
server-side code:

public class TestWS {	
	public void test(Placeholder p) {
		System.out.println("Placeholder.first size: " + p.getFirst().length);
		System.out.println("Placeholder.second size: " + p.getSecond().length);
	}


public class Placeholder {
	private byte[] first = null;
	private byte[] second = null;

	public byte[] getFirst() {
		return first;
	}

	public void setFirst(byte[] first) {
		this.first = first;
	}

	public byte[] getSecond() {
		return second;
	}

	public void setSecond(byte[] second) {
		this.second = second;
	}
}

I call this web method and set the Placeholder's 'first' property to a
5-byte byte array and the 'second' property to a 2-byte byte array.  The
output is very surprising:

Placeholder.first size: 5
Placeholder.second size: 5

What is going on here?  Why is the second byte array the same as the first?

Thanks,
Justin
-- 
View this message in context: http://www.nabble.com/Passing-2-byte-arrays-to-web-service-is-yielding-strange-results-tp24960357p24960357.html
Sent from the Axis - User mailing list archive at Nabble.com.


Mime
View raw message