You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mark Helmstetter <he...@gmail.com> on 2005/03/04 14:50:29 UTC

wsdl2java: Generated code does not compile, "Duplicate method" (constructor)

I have a fairly complex xml schema provided to me that seems to cause
wsdl2java to generate some code that does not comple.  Specifically, I
end up with 2 constructors with the same argument type:

  public MoneyPercentageType(java.math.BigDecimal _value) {
    setMoneyValue(_value);
  }

  public MoneyPercentageType(java.math.BigDecimal _value) {
    setPercentageValue(_value);
  }

Here is a simplified version of the wsdl that illustrates the problem:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <wsdl:types>
                <xs:schema targetNamespace="http://foo.com"
                        xmlns="http://foo.com">
                        <xs:attributeGroup name="CurrencyAmountGroup">
                                <xs:attribute name="Amount"
type="Money" use="optional"/>
                                <xs:attribute name="Percentage"
type="Percentage"
                                        use="optional"/>
                        </xs:attributeGroup>
                        <xs:simpleType name="Money">
                                <xs:restriction base="xs:decimal">
                                        <xs:fractionDigits value="3"/>
                                </xs:restriction>
                        </xs:simpleType>
                        <xs:simpleType name="MoneyPercentageType">
                                <xs:union memberTypes="Money Percentage"/>
                        </xs:simpleType>
                        <xs:simpleType name="Percentage">
                                <xs:restriction base="xs:decimal">
                                        <xs:minInclusive value="0.01"/>
                                        <xs:maxInclusive value="100.00"/>
                                </xs:restriction>
                        </xs:simpleType>
                </xs:schema>
    </wsdl:types>
</wsdl:definitions>

Re: wsdl2java: Generated code does not compile, "Duplicate method" (constructor)

Posted by darshana dias <di...@yahoo.com>.
hi ;
I have same problem that U mentioned in u'r e-mail. I think that there is some problem in lib files. I mean .jar files. axis.jar should have a problem. Try to find newest one.
 
Dias
 

		
---------------------------------
Celebrate Yahoo!'s 10th Birthday! 
 Yahoo! Netrospective: 100 Moments of the Web 

Re: wsdl2java: Generated code does not compile, "Duplicate method" (constructor)

Posted by Anne Thomas Manes <at...@gmail.com>.
I don't believe that Axis supports <union>. 
You will need to build a customer deserializer.

It would be useful, though, for wsdl2java to generate a warning message.

Anne 


On Fri, 4 Mar 2005 08:50:29 -0500, Mark Helmstetter
<he...@gmail.com> wrote:
> I have a fairly complex xml schema provided to me that seems to cause
> wsdl2java to generate some code that does not comple.  Specifically, I
> end up with 2 constructors with the same argument type:
> 
>   public MoneyPercentageType(java.math.BigDecimal _value) {
>     setMoneyValue(_value);
>   }
> 
>   public MoneyPercentageType(java.math.BigDecimal _value) {
>     setPercentageValue(_value);
>   }
> 
> Here is a simplified version of the wsdl that illustrates the problem:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>         xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>         xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <wsdl:types>
>                 <xs:schema targetNamespace="http://foo.com"
>                         xmlns="http://foo.com">
>                         <xs:attributeGroup name="CurrencyAmountGroup">
>                                 <xs:attribute name="Amount"
> type="Money" use="optional"/>
>                                 <xs:attribute name="Percentage"
> type="Percentage"
>                                         use="optional"/>
>                         </xs:attributeGroup>
>                         <xs:simpleType name="Money">
>                                 <xs:restriction base="xs:decimal">
>                                         <xs:fractionDigits value="3"/>
>                                 </xs:restriction>
>                         </xs:simpleType>
>                         <xs:simpleType name="MoneyPercentageType">
>                                 <xs:union memberTypes="Money Percentage"/>
>                         </xs:simpleType>
>                         <xs:simpleType name="Percentage">
>                                 <xs:restriction base="xs:decimal">
>                                         <xs:minInclusive value="0.01"/>
>                                         <xs:maxInclusive value="100.00"/>
>                                 </xs:restriction>
>                         </xs:simpleType>
>                 </xs:schema>
>     </wsdl:types>
> </wsdl:definitions>
>