You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by paul nibin <ni...@gmail.com> on 2010/11/10 07:20:17 UTC

Code generation fails when using the WSDL..

Hi,

I am trying to generate client side code for the following WSDL.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="Manjukiran" xmlns="
http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="
http://xml.apache.org/xml-soap" xmlns:impl="Manjukiran"
xmlns:intf="Manjukiran" xmlns:tns1="http://rpc.xml.coldfusion" 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 Macromedia ColdFusion MX version 7,0,0,91690-->
 <wsdl:types>
  <schema elementFormDefault="qualified" xmlns="
http://www.w3.org/2001/XMLSchema">
   <import namespace="http://rpc.xml.coldfusion"/>
   <element name="echoStringAppend">
    <complexType>
     <sequence>
      <element name="input" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="echoStringAppendResponse">
    <complexType>
     <sequence>
      <element name="echoStringAppendReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="fault" type="tns1:CFCInvocationException"/>
   <element name="echoString">
    <complexType>
     <sequence>
      <element name="input" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="echoStringResponse">
    <complexType>
     <sequence>
      <element name="echoStringReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
  <schema elementFormDefault="qualified" xmlns="
http://www.w3.org/2001/XMLSchema">
   <import namespace="http://rpc.xml.coldfusion"/>
   <element name="echoStringAppend2">
    <complexType>
     <sequence>
      <element name="input" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="echoStringAppend2Response">
    <complexType>
     <sequence>
      <element name="echoStringAppend2Return" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="fault" type="tns1:CFCInvocationException"/>
   <element name="echoString2">
    <complexType>
     <sequence>
      <element name="input" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="echoString2Response">
    <complexType>
     <sequence>
      <element name="echoString2Return" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
  <schema elementFormDefault="qualified" targetNamespace="
http://rpc.xml.coldfusion" xmlns="http://www.w3.org/2001/XMLSchema">
   <complexType name="CFCInvocationException">
    <sequence/>
   </complexType>
  </schema>
 </wsdl:types>
   <wsdl:message name="echoStringRequest">
      <wsdl:part element="impl:echoString" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="CFCInvocationException">
      <wsdl:part element="impl:fault" name="fault"/>
   </wsdl:message>
   <wsdl:message name="echoStringAppendResponse">
      <wsdl:part element="impl:echoStringAppendResponse" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="echoStringResponse">
      <wsdl:part element="impl:echoStringResponse" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="echoStringAppendRequest">
      <wsdl:part element="impl:echoStringAppend" name="parameters"/>
   </wsdl:message>

     <wsdl:message name="CFCInvocationException">
      <wsdl:part element="impl:fault" name="fault"/>
   </wsdl:message>
   <wsdl:message name="echoStringAppend2Request">
      <wsdl:part element="impl:echoStringAppend2" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="echoStringAppend2Response">
      <wsdl:part element="impl:echoStringAppend2Response"
name="parameters"/>
   </wsdl:message>
   <wsdl:message name="echoString2Request">
      <wsdl:part element="impl:echoString2" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="echoString2Response">
      <wsdl:part element="impl:echoString2Response" name="parameters"/>
   </wsdl:message>

  <wsdl:portType name="ws1">
      <wsdl:operation name="echoStringAppend">
         <wsdl:input message="impl:echoStringAppendRequest"
name="echoStringAppendRequest"/>
         <wsdl:output message="impl:echoStringAppendResponse"
name="echoStringAppendResponse"/>
         <wsdl:fault message="impl:CFCInvocationException"
name="CFCInvocationException"/>
      </wsdl:operation>
      <wsdl:operation name="echoString">
         <wsdl:input message="impl:echoStringRequest"
name="echoStringRequest"/>
         <wsdl:output message="impl:echoStringResponse"
name="echoStringResponse"/>
         <wsdl:fault message="impl:CFCInvocationException"
name="CFCInvocationException"/>
      </wsdl:operation>
   </wsdl:portType>
  <wsdl:portType name="ws2">
      <wsdl:operation name="echoStringAppend2">
         <wsdl:input message="impl:echoStringAppend2Request"
name="echoStringAppend2Request"/>
         <wsdl:output message="impl:echoStringAppend2Response"
name="echoStringAppend2Response"/>
         <wsdl:fault message="impl:CFCInvocationException"
name="CFCInvocationException"/>
      </wsdl:operation>
      <wsdl:operation name="echoString2">
         <wsdl:input message="impl:echoString2Request"
name="echoString2Request"/>
         <wsdl:output message="impl:echoString2Response"
name="echoString2Response"/>
         <wsdl:fault message="impl:CFCInvocationException"
name="CFCInvocationException"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="ws1.cfcSoapBinding" type="impl:ws1">
      <wsdlsoap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="echoStringAppend">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="echoStringAppendRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="echoStringAppendResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
         <wsdl:fault name="CFCInvocationException">
            <wsdlsoap:fault name="CFCInvocationException" use="literal"/>
         </wsdl:fault>
      </wsdl:operation>
      <wsdl:operation name="echoString">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="echoStringRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="echoStringResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
         <wsdl:fault name="CFCInvocationException">
            <wsdlsoap:fault name="CFCInvocationException" use="literal"/>
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="ws2.cfcSoapBinding" type="impl:ws2">
      <wsdlsoap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="echoStringAppend2">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="echoStringAppend2Request">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="echoStringAppend2Response">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
         <wsdl:fault name="CFCInvocationException">
            <wsdlsoap:fault name="CFCInvocationException" use="literal"/>
         </wsdl:fault>
      </wsdl:operation>
      <wsdl:operation name="echoString2">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="echoString2Request">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="echoString2Response">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
         <wsdl:fault name="CFCInvocationException">
            <wsdlsoap:fault name="CFCInvocationException" use="literal"/>
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="ws2Service">
      <wsdl:port binding="impl:ws2.cfcSoapBinding" name="ws2.cfc">
         <wsdlsoap:address location="http://localhost:8500/ws2"/>
      </wsdl:port>
   </wsdl:service>
   <wsdl:service name="ws1Service">
      <wsdl:port binding="impl:ws1.cfcSoapBinding" name="ws1.cfc">
         <wsdlsoap:address location="http://localhost:8500/ws2"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

And I got the following error.

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(CodeGenerationEngine.java:271)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
    at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
    at test.ClientGenerator.main(ClientGenerator.java:10)
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
    at
org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:53)
    at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
    ... 3 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:50)
    ... 4 more
Caused by: org.apache.axis2.schema.SchemaCompilationException:
java.lang.NullPointerException
    at
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:289)
    at
org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:103)
    ... 9 more
Caused by: java.lang.NullPointerException
    at
org.apache.axis2.schema.SchemaCompiler.isComponetExists(SchemaCompiler.java:2723)
    at
org.apache.axis2.schema.SchemaCompiler.getParentSchemaFromIncludes(SchemaCompiler.java:2670)
    at
org.apache.axis2.schema.SchemaCompiler.getParentSchema(SchemaCompiler.java:2644)
    at
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:758)
    at
org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:563)
    at
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:370)
    at
org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:280)
    ... 10 more

It seems that targetNamespace attribute is mandatory in schema definition. I
could use Axis 1 to generate the code for this WSDL. There I dont face the
problem with this mandatory namespace attribute.

Could some one help me with modifying the WSDL to use for Axis 2.

Thanks,
Paul