2 Replies Latest reply on Nov 7, 2007 4:25 AM by tpawankumar

    Problem with wsconsume ant task

      Hi All,

      I am using wsconsume ant task for generating client side artifacts.
      The following is ant task


      <target name="generateStub2" description="Generates classes">
       <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
       <classpath refid="wscon.classpath"/>
       </taskdef>
       <wsconsume
       verbose="true"
       destdir="output2"
       sourcedestdir="gen-src2"
       keep="true"
       wsdl="http://localhost:8080/McafeeAdapter?wsdl">
       </wsconsume>
       <jar destfile="./lib/client.jar" basedir="./output2">
       </jar>
      </target>


      It is able to generate stubs using local WSDL file.

      But when i use the following task for remote WSDL file

      <target name="generateStub1" description="Generates classes">
       <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
       <classpath refid="wscon.classpath"/>
       </taskdef>
       <wsconsume
       verbose="true"
       destdir="output1"
       sourcedestdir="gen-src1"
       keep="true"
       wsdl="http://testdrive.mcafeeasap.com/ws/mop/mop.asmx?wsdl">
       </wsconsume>
       <jar destfile="./lib/mcafeeClient.jar" basedir="./output1">
       </jar>
       </target>
      


      It is giving following exception

      [wsconsume] Consuming wsdl: http://testdrive.mcafeeasap.com/ws/mop/mop.asmx?wsdl
      [wsconsume] parsing WSDL...
      [wsconsume] [ERROR] Failed to read the WSDL document: http://testdrive.mcafeeasap.com/ws/mop/mop.asmx?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
      [wsconsume] unknown location
      [wsconsume] Failed to parse the WSDL.
      [wsconsume] Failed to invoke WsImport
      [wsconsume] java.lang.IllegalStateException: WsImport invocation failed. Try the verbose switch for more information
      [wsconsume] at org.jboss.ws.tools.jaxws.impl.SunRIConsumerImpl.consume(SunRIConsumerImpl.java:190)
      [wsconsume] at org.jboss.wsf.spi.tools.WSContractConsumer.consume(WSContractConsumer.java:189)
      [wsconsume] at org.jboss.wsf.spi.tools.ant.WSConsumeTask.executeNonForked(WSConsumeTask.java:206)
      [wsconsume] at org.jboss.wsf.spi.tools.ant.WSConsumeTask.execute(WSConsumeTask.java:226)
      [wsconsume] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
      [wsconsume] at org.apache.tools.ant.Task.perform(Task.java:364)
      [wsconsume] at org.apache.tools.ant.Target.execute(Target.java:301)
      [wsconsume] at org.apache.tools.ant.Target.performTasks(Target.java:328)
      [wsconsume] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
      [wsconsume] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
      [wsconsume] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
      [wsconsume] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)


      The following are the jars which are used for running the task
       <path id="wscon.classpath" >
       <pathelement path ="./lib/activation.jar"/>
       <pathelement path ="./lib/tools.jar"/>
       <pathelement path ="./lib/getopt.jar"/>
       <pathelement path ="./lib/wstx.jar"/>
       <pathelement path ="./lib/jbossall-client.jar"/>
       <pathelement path ="./lib/log4j.jar"/>
       <pathelement path ="./lib/mail.jar"/>
       <pathelement path ="./lib/jbossws-spi.jar"/>
       <pathelement path ="./lib/jaxws-tools.jar"/>
       <pathelement path ="./lib/jaxws-rt.jar"/>
       <pathelement path ="./lib/stax-api.jar"/>
       <pathelement path ="./lib/jaxb-api.jar"/>
       <pathelement path ="./lib/jaxb-impl.jar"/>
       <pathelement path ="./lib/jaxb-xjc.jar"/>
       <pathelement path ="./lib/stax-ex.jar"/>
       <pathelement path ="./lib/streambuffer.jar"/>
       <pathelement path ="./lib/javassist.jar"/>
       <pathelement path ="./lib/jboss-xml-binding.jar"/>
       <pathelement path ="./lib/jboss-jaxws.jar"/>
       <pathelement path ="./lib/jbossws-client.jar"/>
       <pathelement path ="./lib/jboss-jaxrpc.jar"/>
       <pathelement path ="./lib/jboss-saaj.jar"/>
       </path>


      I am not getting what the problem is?

      Am i missing any jars ,if the WSDL is remote.

      Please help me.

      Thanks in Advance.

        • 1. Re: Problem with wsconsume ant task
          ropalka

          Hi,

          this behaviour is really strange to me. Anyway try to set attribute fork="true".

          Richard

          • 2. Re: Problem with wsconsume ant task

            Hi Richard,

            When i set fork="true" i am getting the below exception

            BUILD FAILED: java.lang.NoSuchMethodError: org.apache.tools.ant.taskdefs.ExecuteJava.fork(Lorg/apache/tools/ant/ProjectComponent;)I

            Following is the target

            <target name="generateStub1" description="Generates classes">
             <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
             <classpath refid="wscon.classpath"/>
             </taskdef>
             <wsconsume
             fork="true"
             verbose="true"
             destdir="output1"
             sourcedestdir="gen-src1"
             keep="true"
             wsdl="http://testdrive.mcafeeasap.com/ws/mop/mop.asmx?wsdl">
             </wsconsume>
             <jar destfile="./lib/mcafeeClient.jar" basedir="./output1">
             </jar>
             </target>


            Do i need to keep any jar wscon.classpath?

            Please help me.

            Thanks
            Pavan