axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "keith chapman" <keithgchap...@gmail.com>
Subject Re: [Axis2] Axis2 and Enum type
Date Thu, 30 Aug 2007 04:31:16 GMT
On 8/30/07, Leon Hwang <hwang@mystrands.com> wrote:
>
> Wow...
>
> Thank you, Keith.
>
> Then, I guess, returning enum type won't do any good. (like I can...)
>
> What does people do?
> Is there any alternative?
> Only way I can think of is to return a primitive type or String
> representation of the enum value,
> then communicate with developers wring client, "You have to use this EXACT
> string".


You can communicate this via the WSDL for your service. The schema used to
define the input elements for your operations can use <xs:enumerations>. Any
client having this WSDL knows what the operation expects.

Thanks,
Keith.

Keith, do you happen to know when the enum feature will be supported by
> Axis2?
>
> Thank you, again.
>
> - Leon
>
> keith chapman wrote:
> > Axis2 is JDK 1.4 compatible. Hence it does not use JDK 1.5 features.
> > This is the reason you see code like the following.
> >
> > Gender g = new Gender();
> > g.getFEMALE();
> >
> > Thanks,
> > Keith.
> >
> > On 8/30/07, *Leon Hwang* <hwang@mystrands.com
> > <mailto:hwang@mystrands.com>> wrote:
> >
> >     Hello there,
> >
> >     I created a simple function that returns an object type of enum.
> >     It is very simple function:
> >
> >     public static Gender getGender() {
> >          return Gender.MALE;
> >     }
> >
> >     but when I opened the page from a browser
> >     http://localhost:8080/OpenApi/services/TestApi10/getGender
> >
> >     it generates an error like
> >     <soapenv:Reason>
> >          <soapenv:Text xml:lang="en-US">
> >              java.lang.RuntimeException: org.apache.axis2.AxisFault:
> >     Mapping qname not fond for the package: org.apache.catalina.loader
> >          </soapenv:Text>
> >     </soapenv:Reason>
> >
> >     If I return any other objects, it works fine.
> >     Am I not supposed to Enum type?
> >     I think this is an error in Axis2.
> >     By the way, I would not like to use Type-safe enum.
> >     It has its own problem.
> >
> >     I have attached a source code and services.xml (TestApi.xml ) and
> >     wsdl (TestApi10.xml - created by Axis2 on the fly).
> >
> >
> >     By the way, if I create a client using WSDL2Java
> >     wsdl2java.bat -or -g -Eofv -uw -u -uri
> >     http://localhost:8080/OpenApi/services/UserApi10?wsdl
> >
> >     I get a warning like this:
> >     [WARN] Type {http://www.w3.org/2001/XMLSchema}Enum missing!
> >
> >     How do I get rid of this?
> >
> >     Also WSDL2Java doesn't create a enum type for Gender. Rather it is a
> >     regular class.
> >     Which I have to use it like
> >
> >     Gender g = new Gender();
> >     g.getFEMALE();
> >
> >     This didn't make a sense to me.
> >
> >
> >     As a comparison, .NET create an enum type correctly.
> >     In WSDL that .NET create, it is a just simpleType with restrictions.
> >     I don't know if that caused the problem or not.
> >
> >     I would appreciate if you could give any help on this.
> >
> >     Thank you,
> >
> >     - Leon
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> >     <mailto:axis-dev-unsubscribe@ws.apache.org>
> >     For additional commands, e-mail: axis-dev-help@ws.apache.org
> >     <mailto:axis-dev-help@ws.apache.org>
> >
> >
> >
> >
> > --
> > Keith Chapman
> > WSO2 Inc.
> > Oxygen for Web Services Developers.
> > http://wso2.org/
>
> --
> Leon Hwang
> Senior Tech Lead
> MyStrands Inc.
>
> work: 1.541.753.4426
> mobile: 1.541.740.7511
> fax: 1.541.754.6416
> email: hwang@mystrands.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/

Mime
View raw message