[ http://issues.apache.org/jira/browse/AXIS2-1780?page=all ]

Davanum Srinivas resolved AXIS2-1780.
-------------------------------------

    Resolution: Fixed

Fixed.

thanks,
dims

> WSDL2JAVA fails with multiple anonymous simple types
> ----------------------------------------------------
>
>                 Key: AXIS2-1780
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1780
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.1
>         Environment: JRE1.4.2, Tomcat 4, Axis 2 1.1
>            Reporter: Todd Doolittle
>            Priority: Blocker
>
> The problem is that WSDL2JAVA fails when there is more than 1 anonymous 
> simple type.  For some reason it works fine if there is 1 anonymous simple 
> type.  I'm not sure but this may affect multiple anonymous complex types as 
> well.
> Consider  the example where the schema defines 2 elements (first and last 
> name).  If the schema defined in the WSDL includes 1 anonymous simple type, 
> everything works fine (like this)...
> <xsd:element name="firstName">
>   <xsd:simpleType>
>     <xsd:restriction base="xsd:string">
>       <xsd:maxLength value="10" />
>     </xsd:restriction>
>   </xsd:simpleType>
> </xsd:element>
> <xsd:element name="lastName" type="xsd:string" />
> As soon as you add more than one anonymous simple type (like below) WSDL2JAVA 
> throws an exception.
> <xsd:element name="firstName">
>   <xsd:simpleType>
>     <xsd:restriction base="xsd:string">
>       <xsd:maxLength value="10" />
>     </xsd:restriction>
>   </xsd:simpleType>
> </xsd:element>
> <xsd:element name="lastName">
>   <xsd:simpleType>
>     <xsd:restriction base="xsd:string">
>       <xsd:maxLength value="20" />
>     </xsd:restriction>
>   </xsd:simpleType>
> </xsd:element>
> The exception and full WSDL is listed at the bottom of this email.  We can 
> work around this problem by pulling out all the anonymous simple types and 
> creating named types.  However we are not the ones generating the service 
> code and WSDL.  It is being generated by another language and it uses these 
> anonymous simple (and complex) types extensively.  So we would have to do 
> this for some very complex WSDL across a lot of services and hundreds of 
> operations.  And each time a service or operation was changed we have to do 
> it by hand all over again which would be very tedious and error prone. 
> Exception in thread "main" 
> org.apache.axis2.wsdl.codegen.CodeGenerationException
> : java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>         at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
> ationEngine.java:224)
>         at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
>         at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
> Caused by: java.lang.RuntimeException: 
> java.lang.reflect.InvocationTargetExcepti
> on
>         at 
> org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(Simp
> leDBExtension.java:52)
>         at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
> ationEngine.java:177)
>         ... 2 more
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(Simp
> leDBExtension.java:49)
>         ... 3 more
> Caused by: org.apache.axis2.schema.SchemaCompilationException: 
> java.lang.NullPoi
> nterException
>         at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:25
> 7)
>         at 
> org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java
> :72)
>         ... 8 more
> Caused by: java.lang.NullPointerException
>         at 
> org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.
> java:592)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.
> java:489)
>         at 
> org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:14
> 88)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler
> .java:1450)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompi
> ler.java:950)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(
> SchemaCompiler.java:909)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.j
> ava:864)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.
> java:527)
>         at 
> org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.
> java:499)
>         at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:33
> 6)
>         at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:24
> 8)
>         ... 9 more
> Full WSDL
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>   name="AddressBook" targetNamespace="http://sears.org/";
>   xmlns:sears="http://sears.org/";
>   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>   <wsdl:types>
>     <xsd:schema elementFormDefault="qualified"
>       targetNamespace="http://sears.org/"; xmlns:s1="http://sears.org/";>
>       <xsd:complexType name="Person">
>         <xsd:sequence>
>           <xsd:element name="firstName" type="xsd:string" />
>           <xsd:element name="lastName" type="xsd:string" />
>         </xsd:sequence>
>       </xsd:complexType>
>       <xsd:complexType name="AddressBookEntry">
>         <xsd:sequence>
>           <xsd:element name="firstName">
>             <xsd:simpleType>
>               <xsd:restriction base="xsd:string">
>                 <xsd:maxLength value="10" />
>               </xsd:restriction>
>             </xsd:simpleType>
>           </xsd:element>
>           <xsd:element name="lastName">
>             <xsd:simpleType>
>               <xsd:restriction base="xsd:string">
>                 <xsd:maxLength value="20" />
>               </xsd:restriction>
>             </xsd:simpleType>
>           </xsd:element>
>           <xsd:element name="streetAddress" type="xsd:string" />
>           <xsd:element name="city" type="xsd:string" />
>           <xsd:element name="state" type="xsd:string" />
>           <xsd:element name="zipCode" type="xsd:int" />
>           <xsd:element name="phoneNumber" type="xsd:string" />
>         </xsd:sequence>
>       </xsd:complexType>
>       <xsd:element name="addressLookupRequest" type="Person" />
>       <xsd:element name="addressLookupResponse"
>         type="AddressBookEntry" />
>     </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="AddressLookupIn">
>     <wsdl:part element="sears:addressLookupRequest"
>       name="parameters" />
>   </wsdl:message>
>   <wsdl:message name="AddressLookupOut">
>     <wsdl:part element="sears:addressLookupResponse"
>       name="parameters" />
>   </wsdl:message>
>   <wsdl:portType name="AddressBookPortType">
>     <wsdl:operation name="AddressLookup">
>       <wsdl:input message="sears:AddressLookupIn"
>         name="addressLookupRequest" />
>       <wsdl:output message="sears:AddressLookupOut"
>         name="addressLookupResponse" />
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="AddressBookBinding"
>     type="sears:AddressBookPortType">
>     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; />
>     <wsdl:operation name="AddressLookup">
>       <soap:operation soapAction="AddressLookup" style="document" />
>       <wsdl:input name="addressLookupRequest">
>         <soap:body use="literal" />
>       </wsdl:input>
>       <wsdl:output name="addressLookupResponse">
>         <soap:body use="literal" />
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="AddressBook">
>     <wsdl:port binding="sears:AddressBookBinding"
>       name="AddressBookPortType">
>       <soap:address
>         location="http://localhost:8080/axis2/services/AddressBook"; />
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to