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 "Hall, Alex A." <al...@ngc.com> on 2007/05/01 01:11:50 UTC

wsdl2java error using Xmlbeans binding

Axis Users,

I'm having trouble attempting to generate server-side skeletons for a
WSDL which imports a fairly complex schema.  I extracted the troublesome
part and am including it here.  Using Axis2 version 1.2 and running the
following command on Test.wsdl (contents listed at [1] below):

% wsdl2java -o C:\wsdl\gensrc -d xmlbeans -ss -uri C:\wsdl\Test.wsdl

I get the chained error shown at [2] below.

The exception seems to indicate an invalid schema, but the schema
validates fine using the W3C validator and the WSDL compiles using
Xmlbeans 2.2.0 from the command-line.  It's complaining about the
"xs:minInclusive" element in the Angle type, but interestingly, when I
comment out the "xs:attribute" element in Angle, everything works.  Am I
missing something here?  Perhaps there is a problem in the Axis-Xmlbeans
interface?  Any help or suggestions for a workaround would be greatly
appreciated.

Regards,
Alex Hall
alex.hall@ngc.com

[1] Contents of Test.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             xmlns:tns="http://example.com/TestDataManagerService"
             targetNamespace="http://example.com/TestDataManagerService"
             name="TestDataManagerService">
  <types>
    <xs:schema
targetNamespace="http://example.com/TestDataManagerService">
      <xs:element name="getDataRequest" type="tns:GetDataRequestType"/>
      <xs:element name="getDataResponse"
type="tns:GetDataResponseType"/>
      <xs:complexType name="GetDataRequestType">
        <xs:sequence>
           <xs:element name="id" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="GetDataResponseType">
        <xs:sequence>
           <xs:element name="resultValue" type="tns:Angle"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Measure" abstract="true">
        <xs:simpleContent>
          <xs:extension base="xs:decimal">
            <xs:attribute name="uom" type="xs:string" use="optional"/>
            <xs:attribute name="factor" type="xs:decimal" use="optional"
default="1"/>
          </xs:extension>
        </xs:simpleContent>
      </xs:complexType>
      <xs:complexType name="Angle">
        <xs:simpleContent>
          <xs:restriction base="tns:Measure">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="360"/>
            <xs:attribute name="uom" use="optional" default="deg">
              <xs:simpleType>
                <xs:restriction base="xs:token">
                  <xs:enumeration value="deg"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:restriction>
        </xs:simpleContent>
      </xs:complexType>
    </xs:schema>
  </types>
  <message name="GetDataRequest">
    <part name="getDataRequest" element="tns:getDataRequest"/>
  </message>
  <message name="GetDataResponse">
    <part name="getDataResponse" element="tns:getDataResponse"/>
  </message>
  <portType name="TestDataManagerServicePortType">
    <operation name="getData">
      <input message="tns:GetDataRequest"/>
      <output message="tns:GetDataResponse"/>
    </operation>
  </portType>
  <binding name="TestDataManagerServiceSoapBinding"
type="tns:TestDataManagerServicePortType">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getData">
      <soap:operation soapAction="getData"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="TestDataManagerService">
    <port name="TestDataManagerServiceSoapEndpoint"
binding="tns:TestDataManagerServiceSoapBinding">
      <soap:address
location="http://example.com/TestDataManagerService"/>
    </port>
  </service>
</definitions>

[2] wsdl2java exception:
[chained exceptions removed]
Caused by: org.apache.xmlbeans.XmlException: error:
cvc-complex-type.2.4a: Expected elements
'attribute@http://www.w3.org/2001/XMLSchema
attributeGroup@http://www.w3.org/2001/XMLSchema
anyAttribute@http://www.w3.org/2001/XMLSchema' instead of
'minInclusive@http://www.w3.org/2001/XMLSchema' here in element
restriction@http://www.w3.org/2001/XMLSchema
        at
org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaT
ypeSystemCompiler.java:225)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
        at
org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGener
ationUtility.java:174)
        ... 8 more


Re: wsdl2java error using Xmlbeans binding

Posted by Davanum Srinivas <da...@gmail.com>.
Alex,

Please log a bug with Axis2. With your wsdl and the command line.

thanks,
dims

On 4/30/07, Hall, Alex A. <al...@ngc.com> wrote:
>
>
>
> Axis Users,
>
> I'm having trouble attempting to generate server-side skeletons for a WSDL
> which imports a fairly complex schema.  I extracted the troublesome part and
> am including it here.  Using Axis2 version 1.2 and running the following
> command on Test.wsdl (contents listed at [1] below):
>
> % wsdl2java -o C:\wsdl\gensrc -d xmlbeans -ss -uri C:\wsdl\Test.wsdl
>
> I get the chained error shown at [2] below.
>
> The exception seems to indicate an invalid schema, but the schema validates
> fine using the W3C validator and the WSDL compiles using Xmlbeans 2.2.0 from
> the command-line.  It's complaining about the "xs:minInclusive" element in
> the Angle type, but interestingly, when I comment out the "xs:attribute"
> element in Angle, everything works.  Am I missing something here?  Perhaps
> there is a problem in the Axis-Xmlbeans interface?  Any help or suggestions
> for a workaround would be greatly appreciated.
>
> Regards,
> Alex Hall
> alex.hall@ngc.com
>
> [1] Contents of Test.wsdl:
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
>
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>              xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
> xmlns:tns="http://example.com/TestDataManagerService"
>
> targetNamespace="http://example.com/TestDataManagerService"
>              name="TestDataManagerService">
>   <types>
>     <xs:schema
> targetNamespace="http://example.com/TestDataManagerService">
>       <xs:element name="getDataRequest" type="tns:GetDataRequestType"/>
>       <xs:element name="getDataResponse"
> type="tns:GetDataResponseType"/>
>       <xs:complexType name="GetDataRequestType">
>         <xs:sequence>
>            <xs:element name="id" type="xs:string"/>
>         </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="GetDataResponseType">
>         <xs:sequence>
>            <xs:element name="resultValue" type="tns:Angle"/>
>         </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="Measure" abstract="true">
>         <xs:simpleContent>
>           <xs:extension base="xs:decimal">
>             <xs:attribute name="uom" type="xs:string" use="optional"/>
>             <xs:attribute name="factor" type="xs:decimal" use="optional"
> default="1"/>
>           </xs:extension>
>         </xs:simpleContent>
>       </xs:complexType>
>       <xs:complexType name="Angle">
>         <xs:simpleContent>
>           <xs:restriction base="tns:Measure">
>             <xs:minInclusive value="0"/>
>             <xs:maxInclusive value="360"/>
>             <xs:attribute name="uom" use="optional" default="deg">
>               <xs:simpleType>
>                 <xs:restriction base="xs:token">
>                   <xs:enumeration value="deg"/>
>                 </xs:restriction>
>               </xs:simpleType>
>             </xs:attribute>
>           </xs:restriction>
>         </xs:simpleContent>
>       </xs:complexType>
>     </xs:schema>
>   </types>
>   <message name="GetDataRequest">
>     <part name="getDataRequest" element="tns:getDataRequest"/>
>   </message>
>   <message name="GetDataResponse">
>     <part name="getDataResponse" element="tns:getDataResponse"/>
>   </message>
>   <portType name="TestDataManagerServicePortType">
>     <operation name="getData">
>       <input message="tns:GetDataRequest"/>
>       <output message="tns:GetDataResponse"/>
>     </operation>
>   </portType>
>   <binding name="TestDataManagerServiceSoapBinding"
> type="tns:TestDataManagerServicePortType">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <operation name="getData">
>       <soap:operation soapAction="getData"/>
>       <input>
>         <soap:body use="literal"/>
>       </input>
>       <output>
>         <soap:body use="literal"/>
>       </output>
>     </operation>
>   </binding>
>   <service name="TestDataManagerService">
>     <port name="TestDataManagerServiceSoapEndpoint"
> binding="tns:TestDataManagerServiceSoapBinding">
>       <soap:address
> location="http://example.com/TestDataManagerService"/>
>     </port>
>   </service>
> </definitions>
>
> [2] wsdl2java exception:
> [chained exceptions removed]
> Caused by: org.apache.xmlbeans.XmlException: error:
> cvc-complex-type.2.4a: Expected elements
> 'attribute@http://www.w3.org/2001/XMLSchema
> attributeGroup@http://www.w3.org/2001/XMLSchema
> anyAttribute@http://www.w3.org/2001/XMLSchema' instead of
> 'minInclusive@http://www.w3.org/2001/XMLSchema' here in
> element restriction@http://www.w3.org/2001/XMLSchema
>
>         at
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
>         at
> org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:174)
>         ... 8 more


-- 
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org