views:

159

answers:

1

I'm trying to use groovy ws to call a webservice. One of the properties of the generated class is it's self a class with an enum type. Although the debug messages show that the com.test.FinalActionType is created at runtime when the WSDL is read I can't create an instance of it using code like

proxy.create("com.test.FinalActionType")

When I try and assign a string to my class uin place of an instance of FinalActionType groovy is not able to do the conversion. How can I get an instance of this class to use in a webservice call? I've pasted the important part of the WSDL below.

        <xsd:simpleType name="FinalActionType">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="stop"/>
                <xsd:enumeration value="quit"/>
                <xsd:enumeration value="continue"/>
                <xsd:whiteSpace value="collapse"/>
            </xsd:restriction>
        </xsd:simpleType>
+1  A: 

I don't think it can easily be done yet, not using the available WSClient API.

There was a suggestion to add a "createEnum" method to the WSClient class (see test case patch and issue GMOD-82). Judging by Guillaume Alleon's comments under issue GMOD-4, there should be a way to create an enum instance when WSClient 0.5.1 is released.

Tomislav Nakic-Alfirevic