Thanks again for the previous help. I'm successfully generating compilable code for most cases. My next problem is with arrays. I've attached my wsdl file. wsdl2java.bat ("-l c -a -u -d adb") generates this error:

...
Caused by: org.apache.axis2.schema.SchemaCompilationException: {http://schemas.xmlsoap.org/soap/encoding/}Array is not supported. at org.apache.axis2.schema.SchemaCompiler.findClassName(SchemaCompiler.java:810) at org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1066)
...

If I change the return type for the function getStringArray from "tns1:ArrayOf_xsd_string" to "xsd:string", then the code seems to enerate just fine.

I think I saw this same problem in issue 1466 ( http://issues.apache.org/jira/browse/AXIS2-1466 ), but when I tried following the workaround instructions I got a different error. It looks to me like the listed workaround is incorrect, because adding the "import" tag before the "wsdl:types" tag causes the error below:

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:114)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/import): faultCode=INVALID_WSDL: Encountered illegal extension element 'import' in the context of a 'javax.wsdl.Definition'. Extension elements must be in a namespace other than WSDL's. at com.ibm.wsdl.xml.WSDLReaderImpl.parseExtensibilityElement(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
...


Is there someone who can explain how to get wsdl2java to handle these arrays? Thanks again.


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:foobar" xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:impl="urn:foobar" xmlns:intf="urn:foobar" xmlns:tns1="http://foo.bar.com"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->

<!-- this is invalid wsdl syntax...
<import namespace="http://schemas.xmlsoap.org/soap/encoding/";
                 location="http://schemas.xmlsoap.org/soap/encoding/"/> 
 -->

 <wsdl:types>
  <schema targetNamespace="http://foo.bar.com"; xmlns="http://www.w3.org/2001/XMLSchema";>
   <import namespace="http://xml.apache.org/xml-soap"/>
   <import namespace="urn:foobar"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="FooBarObject">
    <sequence>
     <element name="fooId" nillable="true" type="xsd:string"/>
     <element name="barId" nillable="true" type="xsd:long"/>
    </sequence>
   </complexType>
   <complexType name="ArrayOf_xsd_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="getFooBarRequest">

      <wsdl:part name="fooId" type="xsd:string"/>
      <wsdl:part name="barId" type="xsd:long"/>

   </wsdl:message>

   <wsdl:message name="getFooBarResponse">

      <wsdl:part name="getFooBarReturn" type="tns1:FooBarObject"/>

   </wsdl:message>

   <wsdl:message name="getStringArrayRequest">

      <wsdl:part name="fooId" type="xsd:string"/>
      <wsdl:part name="barId" type="xsd:long"/>

   </wsdl:message>

   <wsdl:message name="getStringArrayResponse">

<!-- this generates the "{http://schemas.xmlsoap.org/soap/encoding/}Array is not supported." error -->
      <wsdl:part name="getStringArrayReturn" type="tns1:ArrayOf_xsd_string"/>

<!-- this seems to work just fine
      <wsdl:part name="getStringArrayReturn" type="xsd:string"/>
-->

   </wsdl:message>

   <wsdl:portType name="FooBarAxisAdapter">

      <wsdl:operation name="getFooBar" parameterOrder="fooId barId">

         <wsdl:input message="impl:getFooBarRequest" name="getFooBarRequest"/>

         <wsdl:output message="impl:getFooBarResponse" name="getFooBarResponse"/>

      </wsdl:operation>
      
      <wsdl:operation name="getStringArray" parameterOrder="fooId barId">

         <wsdl:input message="impl:getStringArrayRequest" name="getStringArrayRequest"/>

         <wsdl:output message="impl:getStringArrayResponse" name="getStringArrayResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="FooBarSoapBinding" type="impl:FooBarAxisAdapter">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getFooBar">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getFooBarRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="urn:foobar" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="getFooBarResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="urn:foobar" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getStringArray">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getStringArrayRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="urn:foobar" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="getStringArrayResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="urn:foobar" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

    </wsdl:binding>

   <wsdl:service name="FooBarAdapterService">

  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
blah blah blah
</wsdl:documentation>

      <wsdl:port binding="impl:FooBarSoapBinding" name="FooBar">

         <wsdlsoap:address location="http://127.0.0.1/metadata/services/FooBar"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

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

Reply via email to