Exactly.. I used the WSDL2Java tool to convert a Enum declaration to a Java
class and I saw these 3 methods in it.. And you need to have one method at
least which return "YourEnumClass" to get the schema in the WSDL, I think..

The thing is that, the outputted Java class from WSDL2Java did not have any
default public constructor.. When I do a Java2WSDL conversion to if with my
service it complains about it.. So clearly all it is not well with these 2
tools who are suppose to mirror image their behavior. (ps: standalone
conversion back to Java works, but not when I add it as a parameter to my
method in the service).

As a service provider for my division, when someone gives me an interface to
publish as a service, I am detailing out a process where the recommended
step is to generate WSDL manually (through WSDL Editors or hand-written)
instead of using the Java2WSDL tool and then use the WSDL2Java tool for the
client stubs. This way the WSDL is accurate to what we want and the client
stubs actually generate the client interface that we want them to use.. (The
fidelity of Java2WSDL and then back to Java is not accurate at times, as per
my observation).

The side benefit of this approach is that at Cisco we have a lot of Perl
applications who would be talking to the service. And Perl's SOAP::Lite
package works directly off the WSDL. Thus accurately defining the WSDL - as
opposed to auto generating it - may be the right way to go.

Thanks for all the help.
--
Rajal



-----Original Message-----
From: Steve Kinsman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 12:35 AM
To: [EMAIL PROTECTED]
Subject: RE: Java2WSDL Enum handling question


Hi, I missed previous posts on this, and I'm not sure what your exact
problem is but maybe the following will help.  I develop using Java2WSDL
then WSDL2Java, and found that for this to work with enums correctly the
original java source needed to have:

 - a getValue() method - String getValue()
 - a fromValue() method - YourEnumClass fromValue(String)
 - a fromString() method - YourEnumClass fromString(String)

Try defining these in your enum class and see how you go!


Steve





                    <Eirik.Wahl@b
                    ravida.no>           To:     <[EMAIL PROTECTED]>
                                         cc:
                    19/12/2002           Subject:     RE: Java2WSDL Enum
handling question
                    16:16
                    Please
                    respond to
                    axis-user





Hi Rajal!

I'm aiming at doing the same, but have had no time yet to look into
this. Since nobody else has answered, I wanted to give you this hint
(although no solution ... yet):

Maybe a way to go is to try this text in your WSDL file, and use
WSDL2Java to see what kind of Java code it generates? The output is
hopefully something java2wsdl expects as input.

On 2002-09-23, 16:35 "Harish Prabandham" wrote:
>Hi,
>
>I defined  a simpleType in wsdl that looks something like this:
>
>
>      <xsd:simpleType name="PlanType">
>        <xsd:restriction base="xsd:int">
>            <xsd:enumeration name="Gold" value="0"/>
>            <xsd:enumeration name="Silver" value="1"/>
>            <xsd:enumeration name="Bronze" value="2"/>
>        </xsd:restriction>
>      </xsd:simpleType>
>
>The resulting wsdl2java generated code does not make use of the "Gold",
>"Silver", "Bronze".  Is there a way I can associate user defined
identifiers
>within the generated code instead of value0, value1 etc. that get
generated
>by default.
>
>
>Thx.
>
>
>Harish

Not much to go on, but could be a way out. Would have tried this myself,
if it wasn't for that I have too little time nowadays. Please let me
know if you find something usefull out from this.

By the way: The question from Harish is till unanswered (as far as I
know).

Regards,
Eirik


> -----Original Message-----
> From: Rajal Shah [mailto:[EMAIL PROTECTED]]
> Sent: 17. desember 2002 20:02
> To: Axis User Mailing List
> Subject: Java2WSDL Enum handling question
>
>
> I've read the discussion thread on enums on this list.. It
> still doesn't
> solve my problem.
>
> I am using the type-safe enumeration in my java class (code
> included below)
> and am hoping to get an enumeration mapping in the WSDL using
> the java2wsdl
> tool. But I am unable to produce it.. Any help in figuring
> out what I'm
> doing wrong would be helpful.
>
> public final class SearchType {
>
>     //this is the dummy constructor requirement for Java2WSDL to work.
>     public SearchType() {
>          this.name = "COMPANY_SEARCH";
>     }
>
>     private SearchType(String name) {
>          this.name = name;
>     }
>
>     private final String name;
>
>     public static final SearchType COMPANY_SEARCH =
>                                       new SearchType
("COMPANY_SEARCH");
>     public static final SearchType SITE_SEARCH =
>                                        new SearchType("SITE_SEARCH");
>     public static final SearchType XYZ_SEARCH = new
> SearchType("XYZ_SEARCH");
>
>     public final String toString() {
>          return name;
>     }
> }
> --
> Rajal
>
>
>







Reply via email to