You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by pi...@gmail.com on 2010/01/15 17:20:57 UTC

WSDL2JAVA, generating the java classes for elements with default values

Hi,

is it possible with CXF 2.1.2 to generate the elements which are sended
by/to the WSserver, with their default values declared as they are i nthe
WSDL ?

like I've the element :

<xs:complexType name="Personinfo">
        <xs:sequence>
            <xs:element minOccurs="1" maxOccurs="1" name="param"
                type="xs:string" default="test">
            </xs:element>
        </xs:sequence>
</xs:complexType>

and I would like wsdl2java to generate something like :

public class Personinfo{

    @XmlElement(name = "param")
    protected String param = "test";

    public String getParam() {
        return param ;
    }

    public void setParam(String value) {
        this.param = value;
    }
}



is there a way to do that ? the argument "-defaultvalues" do not do that .

Re: WSDL2JAVA, generating the java classes for elements with default values

Posted by Daniel Kulp <dk...@apache.org>.
You need to use our XJC "default value" plugin.     Add:

-xjc-Xdv 

to the wsdl2java command line.



Dan



On Fri January 15 2010 11:20:57 am piebetz@gmail.com wrote:
> Hi,
> 
> is it possible with CXF 2.1.2 to generate the elements which are sended
> by/to the WSserver, with their default values declared as they are i nthe
> WSDL ?
> 
> like I've the element :
> 
> <xs:complexType name="Personinfo">
>         <xs:sequence>
>             <xs:element minOccurs="1" maxOccurs="1" name="param"
>                 type="xs:string" default="test">
>             </xs:element>
>         </xs:sequence>
> </xs:complexType>
> 
> and I would like wsdl2java to generate something like :
> 
> public class Personinfo{
> 
>     @XmlElement(name = "param")
>     protected String param = "test";
> 
>     public String getParam() {
>         return param ;
>     }
> 
>     public void setParam(String value) {
>         this.param = value;
>     }
> }
> 
> 
> 
> is there a way to do that ? the argument "-defaultvalues" do not do that .
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog