You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Tewari, Vijay" <vi...@intel.com> on 2003/11/18 02:17:53 UTC

Returning array of objects from Axis Web service

I am trying the following with Axis


public class Foo()
{
	public bar myMehtod()
	{
		bar[] b = new bar[5];

		for(int i = 0; i < 5; i++)
		{
			bar[i] = new bar();
			bar[i].setName("hello");
		}
		return b;
	}
}

When I invoke this from a client a java.lang.NullPointerException as the
faultstring. 

What am I doing wrong?


Regards
Vijay


RE: Returning array of objects from Axis Web service

Posted by Liviu Tudor <li...@cimage.com>.
Would it be because you're trying to return a bar array from a method which
is meant to return just a bar element????

public class Foo()
{
	public *bar* myMehtod()
	{
		*bar[] b* = new bar[5];

		for(int i = 0; i < 5; i++)
		{
			bar[i] = new bar();
			bar[i].setName("hello");
		}
		return *b*;
	}
}


Liviu Tudor
"Which painting in the National Gallery would I save if there was a fire?
The one nearest the door of course!" G.B. Shaw



-----Original Message-----
From: Tewari, Vijay [mailto:vijay.tewari@intel.com]
Sent: Tuesday, November 18, 2003 1:18 AM
To: axis-user@ws.apache.org
Subject: Returning array of objects from Axis Web service


I am trying the following with Axis


public class Foo()
{
	public bar myMehtod()
	{
		bar[] b = new bar[5];

		for(int i = 0; i < 5; i++)
		{
			bar[i] = new bar();
			bar[i].setName("hello");
		}
		return b;
	}
}

When I invoke this from a client a java.lang.NullPointerException as the
faultstring.

What am I doing wrong?


Regards
Vijay