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 Jansen Werner <We...@eon-is.com> on 2006/07/05 12:56:26 UTC

Beanserializers and Namespaces (Axis1 1.3)

Hi everybody,

I still have this open issue with Axis concerning BeanSerializers and
namespaces. Classes serialized with this serializer do not have a
namespace associated to their elements (=properties) and I don't why and
- what's even more important - how to make the BeanSerializer use the
namespace.

There is a simple class, UserInfo for example. It only consists of two
"properties", userName and userDescription that are accessible via the
standard getter/setter pairs. The parameterless default constructor is
present as well.

Since this class is so simple, I decided to serialize it using
BeanSerializer:

(call is an axis client call object)

call.registerTypeMapping(UserInfo.class, 
        new QName(Constants.PRS_NAMESPACE_URI, "UserInfo"), 
        new BeanSerializerFactory(UserInfo.class, 
              new QName(Constants.PRS_NAMESPACE_URI, "UserInfo")),
        new BeanDeserializerFactory(UserInfo.class, 
              new QName(Constants.PRS_NAMESPACE_URI, "UserInfo")));


A call to the Web Service, however does not look like I expected it to
be. This is what goes over the wire (abbreviated):

<ns1:UserInfo xmlns:ns1="....">
    <userName>username</username>
    <userDescription>userdescription</userdescription>
</ns1:UserInfo>

The XML tag corresponding to the serialized class has its namespace, but
not the properties of the serialized tags (i.e. the tags below
<ns1:UserInfo />). 

Where's my mistake? What do I miss?

Thanks in advance,

Werner

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


RE: Beanserializers and Namespaces (Axis1 1.3)

Posted by Jansen Werner <We...@eon-is.com>.
Hallo there, 
 
there is another option, I think. If I understood this thing right, you
can add something like a descriptor for your Bean to the BeanSerializer.
Within this descriptor, you can map properties to different names for
XML tags and so on. And there's a property fiddling with namespaces. So
perhaps you can manually assign the namespace to every property. But
this solution would be very ugly as well. Why would I use a
BeanSerializer if I have to map properties by myself, just to correct a
(in my eyes) stupid behaviour concerning namespaces? Custom type mapping
isn't more complex than this ...
 
But like you said, I as well don't give up hope that Axis isn't this
primitive. :)
 
Werner


________________________________

	From: Chris List [mailto:cmblist@yahoo.com] 
	Sent: Friday, July 07, 2006 2:44 AM
	To: axis-user@ws.apache.org
	Subject: Re: Beanserializers and Namespaces (Axis1 1.3)
	
	
	I'd like the answer to this one as well.  So far I have come up
with two options that I don't like so much.  I am hoping Axis isn't this
primitive...
	
	1) Tweak the WSDL so all complex types use the default
namespace.
	2) Cut and paste the Axis generated client side bean code into
your server side value object.
	
	I don't like either but that is how I solved it until someone
has a better answer.
	
	Jansen Werner <We...@eon-is.com> wrote: 

		Hi everybody,
		
		I still have this open issue with Axis concerning
BeanSerializers and
		namespaces. Classes serialized with this serializer do
not have a
		namespace associated to their elements (=properties) and
I don't why and
		- what's even more important - how to make the
BeanSerializer use the
		namespace.
		
		There is a simple class, UserInfo for example. It only
consists of two
		"properties", userName and userDescription that are
accessible via the
		standard getter/setter pairs. The parameterless default
constructor is
		present as well.
		
		Since this class is so simple, I decided to serialize it
using
		BeanSerializer:
		
		(call is an axis client call object)
		
		call.registerTypeMapping(UserInfo.class, 
		new QName(Constants.PRS_NAMESPACE_URI, "UserInfo"), 
		new BeanSerializerFactory(UserInfo.class, 
		new QName(Constants.PRS_NAMESPACE_URI, "UserInfo")),
		new BeanDeserializerFactory(UserInfo.class, 
		new QName(Constants.PRS_NAMESPACE_URI, "UserInfo")));
		
		
		A call to the Web Service, however does not look like I
expected it to
		be. This is what goes over the wire (abbreviated):
		
		
		username
		userdescription
		
		
		The XML tag corresponding to the serialized class has
its namespace, but
		not the properties of the serialized tags (i.e. the tags
below
		). 
		
		Where's my mistake? What do I miss?
		
		Thanks in advance,
		
		Werner
		
	
---------------------------------------------------------------------
		To unsubscribe, e-mail:
axis-user-unsubscribe@ws.apache.org
		For additional commands, e-mail:
axis-user-help@ws.apache.org
		
		


	
________________________________

	Do you Yahoo!?
	Everyone is raving about the all-new Yahoo! Mail Beta.
<http://us.rd.yahoo.com/evt=42297/*http://advision.webevents.yahoo.com/h
andraisers> 


Re: Beanserializers and Namespaces (Axis1 1.3)

Posted by Chris List <cm...@yahoo.com>.
I'd like the answer to this one as well.  So far I have come up with two options that I don't like so much.  I am hoping Axis isn't this primitive...

1) Tweak the WSDL so all complex types use the default namespace.
2) Cut and paste the Axis generated client side bean code into your server side value object.

I don't like either but that is how I solved it until someone has a better answer.

Jansen Werner <We...@eon-is.com> wrote: Hi everybody,

I still have this open issue with Axis concerning BeanSerializers and
namespaces. Classes serialized with this serializer do not have a
namespace associated to their elements (=properties) and I don't why and
- what's even more important - how to make the BeanSerializer use the
namespace.

There is a simple class, UserInfo for example. It only consists of two
"properties", userName and userDescription that are accessible via the
standard getter/setter pairs. The parameterless default constructor is
present as well.

Since this class is so simple, I decided to serialize it using
BeanSerializer:

(call is an axis client call object)

call.registerTypeMapping(UserInfo.class, 
        new QName(Constants.PRS_NAMESPACE_URI, "UserInfo"), 
        new BeanSerializerFactory(UserInfo.class, 
              new QName(Constants.PRS_NAMESPACE_URI, "UserInfo")),
        new BeanDeserializerFactory(UserInfo.class, 
              new QName(Constants.PRS_NAMESPACE_URI, "UserInfo")));


A call to the Web Service, however does not look like I expected it to
be. This is what goes over the wire (abbreviated):


    username
    userdescription


The XML tag corresponding to the serialized class has its namespace, but
not the properties of the serialized tags (i.e. the tags below
). 

Where's my mistake? What do I miss?

Thanks in advance,

Werner

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



 		
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.