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 "Kraus, David" <dk...@MicroStrategy.com> on 2008/04/16 02:51:19 UTC
excluding pojo fields from wsdl
I am using Axis2 1.2 and have deployed a simple service as a POJO. I
created my client using wsld2java based on the WSDL generated from the
POJO service.
One of the objects, which is returned from a web service method, has
some public static fields. These fields are being included in the WSDL.
However, since these static fields don't have getters/setters, they
weren't being serialized on return, which caused an "Unexpected element
return" error at the client. Adding getters/setters gets rid of the
problem, as long as the getters/setters are not static ( which is
strange). In any case, these public static fields do not need to be
serialized, and their inclusion in the WSDL causes problems. Using
getters/setters is very awkward since they aren't really needed since
the fields really should be public static final, which I tried using. I
have also tried using the java transient keyword, but that doesn't seem
to work. I have also tried using excludeProperties (beanPropertyRules)
in services.xml, and that didn't seem to work. Is there a way to exclude
these public static fields from the WSDL generated from the deployed
POJO?
Example of return class below:
Thanks, Dave
public class EnumNormal {
private String _value;
public EnumNormal() {}
public EnumNormal(String value)
{
_value = value;
}
public String getValue()
{
return _value;
}
public void setValue(String value)
{
_value = value;
}
public static String firstEnumVal = "FirstEnumVal";
public static String secondEnumVal = "SecondEnumVal";
public static String thirdEnumVal = "ThirdEnumVal";
public static String fourthEnumVal = "FourthEnumVal";
public static String fifthEnumVal = "FifthEnumVal";
}
RE: Excluding POJO fields from WSDL?
Posted by "Kraus, David" <dk...@MicroStrategy.com>.
Glen Verran also asked a similar question in his email: "How can I
exclude classes from Axis2?"
Does anyone know how to exclude a field from a class, or the whole class
from being included in the WSDL? We both tried the transient approach,
which didn't work.
Are there improvements in Axis2 1.3, 1.4 in this area?
Thanks, Dave
________________________________
From: Kraus, David
Sent: Tuesday, April 15, 2008 5:51 PM
To: axis-user@ws.apache.org
Subject: excluding pojo fields from wsdl
I am using Axis2 1.2 and have deployed a simple service as a POJO. I
created my client using wsld2java based on the WSDL generated from the
POJO service.
One of the objects, which is returned from a web service method, has
some public static fields. These fields are being included in the WSDL.
However, since these static fields don't have getters/setters, they
weren't being serialized on return, which caused an "Unexpected element
return" error at the client. Adding getters/setters gets rid of the
problem, as long as the getters/setters are not static ( which is
strange). In any case, these public static fields do not need to be
serialized, and their inclusion in the WSDL causes problems. Using
getters/setters is very awkward since they aren't really needed since
the fields really should be public static final, which I tried using. I
have also tried using the java transient keyword, but that doesn't seem
to work. I have also tried using excludeProperties (beanPropertyRules)
in services.xml, and that didn't seem to work. Is there a way to exclude
these public static fields from the WSDL generated from the deployed
POJO?
Example of return class below:
Thanks, Dave
public class EnumNormal {
private String _value;
public EnumNormal() {}
public EnumNormal(String value)
{
_value = value;
}
public String getValue()
{
return _value;
}
public void setValue(String value)
{
_value = value;
}
public static String firstEnumVal = "FirstEnumVal";
public static String secondEnumVal = "SecondEnumVal";
public static String thirdEnumVal = "ThirdEnumVal";
public static String fourthEnumVal = "FourthEnumVal";
public static String fifthEnumVal = "FifthEnumVal";
}
RE: excluding pojo fields from wsdl
Posted by "Kraus, David" <dk...@MicroStrategy.com>.
Thanks for the link, but as I mentioned in my original email, I had
tried the excludeProperties approach in my services.xml file. Maybe I
didn't do it correctly. I noticed that Glen Verran also tried that
approach with no success.
Where in the services.xml file do the beanPropertyRules go?
Dave
-----Original Message-----
From: Deepal jayasinghe [mailto:deepalk@gmail.com]
Sent: Wednesday, April 16, 2008 11:36 PM
To: axis-user@ws.apache.org
Subject: Re: excluding pojo fields from wsdl
Hi Kraus,
Please have a look at the following article [section : How to exclude
Bean properties?]
http://wso2.org/library/2893
>
> I am using Axis2 1.2 and have deployed a simple service as a POJO. I
> created my client using wsld2java based on the WSDL generated from the
> POJO service.
>
>
>
> One of the objects, which is returned from a web service method, has
> some */public/* */static/* fields. These fields are being included in
> the WSDL. However, since these */static/* fields don't have
> getters/setters, they weren't being serialized on return, which caused
> an "Unexpected element return" error at the client. Adding
> getters/setters gets rid of the problem, as long as the
> getters/setters are not */static/* ( which is strange). In any case,
> these */public/* */static/* fields do not need to be serialized, and
> their inclusion in the WSDL causes problems. Using getters/setters is
> very awkward since they aren't really needed since the fields really
> should be */public static final/*, which I tried using. I have also
> tried using the java */transient/* keyword, but that doesn't seem to
> work. I have also tried using */excludeProperties/*
> (*/beanPropertyRules/*) in services.xml, and that didn't seem to work.
> Is there a way to exclude these */public/* */static/* fields from the
> WSDL generated from the deployed POJO?
>
>
>
> Example of return class below:
>
>
>
> Thanks, Dave
>
>
>
>
>
> *public* *class* EnumNormal {
>
> *private* String _value;
>
>
>
> *public* EnumNormal() {}
>
>
>
> *public* EnumNormal(String value)
>
> {
>
> _value = value;
>
> }
>
>
>
> *public* String getValue()
>
> {
>
> *return* _value;
>
> }
>
>
>
> *public* *void* setValue(String value)
>
> {
>
> _value = value;
>
> }
>
>
>
> *public* *static* String /firstEnumVal/ = "FirstEnumVal";
>
> *public* *static* String /secondEnumVal/ = "SecondEnumVal";
>
> *public* *static* String /thirdEnumVal/ = "ThirdEnumVal";
>
> *public* *static* String /fourthEnumVal/ = "FourthEnumVal";
>
> *public* *static* String /fifthEnumVal/ = "FifthEnumVal";
>
>
>
> }
>
>
>
--
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"
---------------------------------------------------------------------
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
Re: excluding pojo fields from wsdl
Posted by Deepal jayasinghe <de...@gmail.com>.
Hi Kraus,
Please have a look at the following article [section : How to exclude
Bean properties?]
http://wso2.org/library/2893
>
> I am using Axis2 1.2 and have deployed a simple service as a POJO. I
> created my client using wsld2java based on the WSDL generated from the
> POJO service.
>
>
>
> One of the objects, which is returned from a web service method, has
> some */public/* */static/* fields. These fields are being included in
> the WSDL. However, since these */static/* fields don’t have
> getters/setters, they weren’t being serialized on return, which caused
> an “Unexpected element return” error at the client. Adding
> getters/setters gets rid of the problem, as long as the
> getters/setters are not */static/* ( which is strange). In any case,
> these */public/* */static/* fields do not need to be serialized, and
> their inclusion in the WSDL causes problems. Using getters/setters is
> very awkward since they aren’t really needed since the fields really
> should be */public static final/*, which I tried using. I have also
> tried using the java */transient/* keyword, but that doesn’t seem to
> work. I have also tried using */excludeProperties/*
> (*/beanPropertyRules/*) in services.xml, and that didn’t seem to work.
> Is there a way to exclude these */public/* */static/* fields from the
> WSDL generated from the deployed POJO?
>
>
>
> Example of return class below:
>
>
>
> Thanks, Dave
>
>
>
>
>
> *public* *class* EnumNormal {
>
> *private* String _value;
>
>
>
> *public* EnumNormal() {}
>
>
>
> *public* EnumNormal(String value)
>
> {
>
> _value = value;
>
> }
>
>
>
> *public* String getValue()
>
> {
>
> *return* _value;
>
> }
>
>
>
> *public* *void* setValue(String value)
>
> {
>
> _value = value;
>
> }
>
>
>
> *public* *static* String /firstEnumVal/ = "FirstEnumVal";
>
> *public* *static* String /secondEnumVal/ = "SecondEnumVal";
>
> *public* *static* String /thirdEnumVal/ = "ThirdEnumVal";
>
> *public* *static* String /fourthEnumVal/ = "FourthEnumVal";
>
> *public* *static* String /fifthEnumVal/ = "FifthEnumVal";
>
>
>
> }
>
>
>
--
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org