5 Replies Latest reply on Sep 28, 2007 1:55 PM by ebonnett

    Ant doesn 't Recognize WSConsumeTask

    ebonnett

      I apologize in advance if the answer to this question is obvious and I've just missed it. Seems like it should simple. I've installed JBossWS 2.0.0.GA on JBoss 4.2.1.GA by running the deploy-jboss42 task. I've created a simple web service and have successfully deployed it. Also, I've used the wsconsume.bat file to generate client side code to access the web service. However, I'd like to use the WSConsumeTask Ant task from my project's build script to do this and this is where I'm stuck. What do I need to do to get Ant to recognize this task? I'm running Ant 1.7.0. I haven't found any documentation on this topic. However, I looked in some of the JBossWS jar files and found the WSConsumeTask class in jbossws-spi.jar. So, I copied this file to the %ANT_HOME%/lib directory. But, this didn't help. The error I'm seeing when I run my project's build script is:

      generateClientFiles:
      C:\XCAFE\CommonModules\WebServicesTest\build.xml:132: Problem: failed to create task or type WSConsumeTask
      Cause: The name is undefined.
      Action: Check the spelling.
      Action: Check that any custom tasks/types have been declared.
      Action: Check that any / declarations have taken place.
      BUILD FAILED (total time: 0 seconds)

      So, what do I need to do to get Ant to recognize the WSConsumeTask? Thanks in advance for any help!

      Eric

        • 1. Re: Ant doesn 't Recognize WSConsumeTask
          peterj

          Did you include this taskdef:

          <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
           <classpath>
           <path refid="xxx" />
           </classpath>
          </taskdef>


          where "xxx" points to the jbossws-spi.jar file?

          • 2. Re: Ant doesn 't Recognize WSConsumeTask
            ebonnett

            No, I hadn't included that. Thanks! That definitely got me farther along. But, now I'm seeing a NoClassDefFoundError on WSConsume. It looks like this class is also in jbossws-spi.jar. So, WTF? I tried building a classpath that includes just about everything related to JBoss and JBossWS and got the same result. Any suggestions? I sincerely apologize if this is just my ignorance of Ant.

            Eric

            generateClientFiles:
            Consuming wsdl: WebServicesTestService.wsdl
            Command invoked: org.jboss.wsf.spi.tools.cmd.WSConsume -k -w handEdited.wsdl -o C:\XCAFE\CommonModules\WebServicesTest\output -s C:\XCAFE\CommonModules\WebServicesTest\gen-src -v WebServicesTestService.wsdl
            java.lang.NoClassDefFoundError: org/jboss/wsf/spi/tools/cmd/WSConsume
            Exception in thread "main"
            C:\XCAFE\CommonModules\WebServicesTest\build.xml:176: Could not invoke WSConsumeTask
            BUILD FAILED (total time: 0 seconds)

































            • 3. Re: Ant doesn 't Recognize WSConsumeTask
              ebonnett

              Hmm, looks like my script got stripped from the previous message. Let me try that again...

              
               <path id="jbossws.classpath">
               <fileset dir="C:/jboss-4.2.1.GA/client">
               <include name="**/*.jar"/>
               </fileset>
               <fileset dir="C:/jboss-4.2.1.GA/lib">
               <include name="**/*.jar"/>
               </fileset>
               <fileset dir="C:/jboss-4.2.1.GA/server/default/lib">
               <include name="**/*.jar"/>
               </fileset>
               <fileset dir="C:/jbossws-native-2.0.0.GA/lib">
               <include name="**/*.jar"/>
               </fileset>
               <pathelement location="C:/jbossws-native-2.0.0.GA/lib/jbossws-spi.jar"/>
               </path>
              
              
               <target name="generateClientFiles">
              
               <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
               <classpath>
               <path refid="jbossws.classpath" />
               </classpath>
               </taskdef>
              
               <wsconsume
               fork="true"
               verbose="true"
               destdir="output"
               sourcedestdir="gen-src"
               keep="true"
               wsdllocation="handEdited.wsdl"
               wsdl="WebServicesTestService.wsdl">
               </wsconsume>
              
               </target>
              
              


              • 4. Re: Ant doesn 't Recognize WSConsumeTask
                peterj

                That class (org/jboss/wsf/spi/tools/cmd/WSConsume) also appears in jbossws-native-2.0.0.GA/lib/jbossws-spi.jar.

                I successfully generated the stubs using the path and target you posted, though I only required jboss-4.2.1.GA/client and jbossws-native-2.0.0.GA/lib in the classpath.

                I would suggest downloading JBossWS 2.0.0GA again, youra might be corrupt.

                • 5. Re: Ant doesn 't Recognize WSConsumeTask
                  ebonnett

                  I don't know about my original download being corrupt, but I followed your advice and downloaded it again, but I grabbed jbossws-native-2.0.1.GA.zip this time and ran ant deploy-jboss42 and voila! Now, my project's build script that calls the wsconsume works! Thank you!!!!!

                  Eric