axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kraus, David" <dkr...@MicroStrategy.com>
Subject RE: Nested return types from POJO web service method -shouldn't this work?
Date Fri, 29 Feb 2008 20:50:32 GMT
Ok... this is what is happening. It seems that the name of a member
variable is affecting serialization...My objects, which were having
problems, had fields starting with a low cap "a", and continuing with a
large cap letter....

This version of nested object works fine...

public class NestedObj {
	
	private String nestedVal;
	
	public NestedObj()
	{
		nestedVal = null;
	}
	
	public String getNestedVal()
	{
		return anestedVal;
	}
	
	public void setNestedVal(String nestedVal)
	{
		this.nestedVal = nestedVal;
	}
}

This version of the nested object causes serialization to skip
serialization of the object...

public class NestedObj {
	
	private String aNestedVal;
	
	public NestedObj()
	{
		aNestedVal = null;
	}
	
	public String getANestedVal()
	{
		return aNestedVal;
	}
	
	public void setANestedVal(String nestedVal)
	{
		this.aNestedVal = nestedVal;
	}
}

Finally when I use this version, it works again...

public class NestedObj {
	
	private String anestedVal;
	
	public NestedObj()
	{
		anestedVal = null;
	}
	
	public String getAnestedVal()
	{
		return anestedVal;
	}
	
	public void setAnestedVal(String nestedVal)
	{
		this.anestedVal = nestedVal;
	}
}

So, in conclusion, serialization seems to skip the nested object field,
when the name of the field has one small cap letter followed by a large
cap letter. This results is a get and set methods which have two caps in
a row in the name(eg. setANestedVal - "AN").

Is this a bug, or a pattern I am not aware of?

Thanks, Dave

-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, February 29, 2008 11:13 AM
To: Kraus, David
Cc: axis-user@ws.apache.org
Subject: Re: Nested return types from POJO web service method -shouldn't
this work?

David-

Take a look at
http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/Pro
pert
yUtilsBean.html
specifically the copyProperties method..
copyProperties(java.lang.Object dest,
                           java.lang.Object orig)

As copyProperties method is a shallow copy I think you may want to
handle
*deep* copy programatically..

HTH
M--
----- Original Message -----
From: "Kraus, David" <dkraus@MicroStrategy.com>
To: "Kraus, David" <dkraus@MicroStrategy.com>; <axis-user@ws.apache.org>
Sent: Friday, February 29, 2008 1:02 PM
Subject: RE: Nested return types from POJO web service method -shouldn't
this work?


I have verified that I can correctly use nested return types in a POJO
service. Now I need to figure out why my more complex POJO service is
not working correctly....



Dave



________________________________

From: Kraus, David
Sent: Thursday, February 28, 2008 10:40 PM
To: axis-user@ws.apache.org
Subject: RE: Nested return types from POJO web service method -shouldn't
this work?



Yes, I didn't show it, but my classes did have getters/setters, default
public constructor, and basically obeyed the rules of a JavaBean.



Dave



________________________________

From: Deepal Jayasinghe [mailto:deepal@opensource.lk]
Sent: Fri 2/29/2008 1:01 AM
To: axis-user@ws.apache.org
Subject: Re: Nested return types from POJO web service method -shouldn't
this work?



> I have defined a POJO service which has a method which returns an
> object which contains fields that are nested non-simple objects.
>
>
>
> So given the *Pojo* class which implements *ReturnInfoObject*, the
> *InfoObj* object being returned contains a field *nest* which is
> defined by the *NestedObj* object.
>
>
>
> *public class Pojo*
>
> *{*
>
> *   public InfoObj ReturnInfoObject()*
>
> *   {*
>
> *      ...*
>
> *   }*
>
> *}*
>
> * *
>
> * *
>
> *public class InfoObj*
>
> *{*
>
> *    **private** java.lang.String val;*
>
> *    private NestedObj nest;*
>
> *}*
>
> * *
>
> *public class NestedObj*
>
> *{*
>
> *   private** java.lang.String nestedVal;*
>
> *}*
>
>
>
> When my client calls the deployed *Pojo* service, the *val* field of
> *InfoObj* shows up in the soap trace, but the *nest* field is empty,
> even when it has been correctly allocated on the service side.
>
Nope this can not be happen , however you need to remember that you
class should be JavaBean (need to have getters and settes). I have
tested this and working fine , in addition to that following link will
be helpful for you to understand about Axis2 POJO.

http://www.developer.com/java/other/article.php/10936_3726461_3

Thank you
Deepal


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org




------------------------------------------------------------------------
----
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message