Amil,

First, please refer to the attached email.
According to Sanka, the enum type fix is on the table for the next release.
I would like to confirm with you this would be in Axis2 1.4.
By the way, when does it get released? In October?

To respond to your answer:
Yes, wsdl2java might support enum type.
But the problem is that the server spits out a complex type instead of a simple 
type with restrictions.
Please try it yourself.
This problem could be solved by writing a custome WSDL or a custome data 
locator.

However, here's the REAL main problem.
The server does NOT work with any enum type.
You will encounter a runtime exception when it returns or accepts an enum type.

I wonder if this is all solved in the nightly-build version now.

Thanks,

- Leon



Amila Suriarachchi wrote:


On 9/3/07, *Mark Nüßler* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    hello leon,

    it seems to me, that java2wsdl and wsdl2java does not support enums.


wsdl2java support this. in a wsdl enumeration is represented by a simple type restriction enumeration.
eg.
<simpletype name="test">
  <restriction base = "xs:string">
     <enumeration value="testvalue"/>
  </restriction>
</simpletype>

and this type of xsd are supported in wsdl2java.

    a workaround that works 4 me is to replace the enum with a String
    before generating anything.

    on the serverside convert your enum to String

    Gender g = Gender.MALE;
    String g_send = g.toString();

    an on clientside test, if the String is a valid enum

    try {
            Gender g_test = Gender.valueOf (g_send.toUpperCase());
            System.out.println("valid Gender");
    } catch(Exception e) {
            System.out.println("invalid Gender");
    }

    i know its just a workaround

    mfg derMark







    Leon Hwang schrieb:
     > Can someone explain how I can return enum type object from Axis2
    server?
     >
     > I am using Axis2 1.3 / Tomcat 6.
     >
     >
    ---------------------------------------------------------------------
     > To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
     > For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
     >
     >
     >

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>




--
Amila Suriarachchi,
WSO2 Inc.

--
Leon Hwang
MyStrands, Inc.

work: 1.541.753.4426
mobile: 1.541.740.7511
fax: 1.541.754.6416
email: [EMAIL PROTECTED]
--- Begin Message ---
On 8/30/07, Leon Hwang <[EMAIL PROTECTED]> 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".
>
> Keith, do you happen to know when the enum feature will be supported by
> Axis2?



It is on the table for next Axis2 release version.

Best,
Sanka

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* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> 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: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     For additional commands, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> > --
> > 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: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Sanka Samaranayake
WSO2 Inc.

http://www.bloglines.com/blog/sanka
http://www.wso2.org/

--- End Message ---
begin:vcard
fn:Leon Hwang
n:Hwang;Leon
email;internet:[EMAIL PROTECTED]
tel;work:1.541.753.4426
tel;fax:1.541.754.6416
tel;cell:1.541.740.7511
note;quoted-printable:************************************************************************=0D=0A=
	Recommenders06 - Late Summer School on=0D=0A=
	THE PRESENT AND FUTURE OF RECOMMENDER SYSTEMS=0D=0A=
	September 12-13, 2006. Bilbao, Spain=0D=0A=
	http://Recommenders06.com=0D=0A=
	************************************************************************
x-mozilla-html:TRUE
version:2.1
end:vcard


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to