4 Replies Latest reply on Sep 15, 2006 1:23 PM by Amit Sri

    How to generate mapping.xml & webservices.xml from WSDL?

    Amit Sri Newbie


      I am trying to package a webservice starting with a WSDL, I have to deploy it on JBoss 4.0.2 (So, I can't use JBossWS tool). I have to handcraft the deployment descriptors - webservices.xml, mapping.xml etc after generating server side stubs from Apache Axis WSDL2Java Tool.

      Are there any JBoss tool available which could generate these deployment descriptors for me?

      Thanks in Advance,
      Amit Srivastava..

        • 1. Re: How to generate mapping.xml & webservices.xml from WSDL?
          Dominic Campbell Newbie


          You can generate the mapping using the "wstools" tool (!), which takes a configuration file to tell it what to do. Here is an example of a configuration file (one I am using for testing at the moment, so excuse some of the hard coded stuff):

          <?xml version="1.0" encoding="UTF-8"?>
          <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
           <package-namespace package="itag.wswg.rm.services.ss" namespace="http://itag.wswg.rm"/>
          <wsdl-java file="C:/AllStuff/eclipse/jbossWorkspace/webby/resources/WSDL/SequenceService.wsdl">
           <mapping file="itag/wswg/rm/SequenceService-mapping.xml" />

          This will take a WSDL file and create the necessary Java classes using the package specified in the "global" section, together with the mapping file as specified.

          I do not know if you can generate the webservices.xml file, I just have a template and copy/tailor that to suit, same for the web.xml file.

          I call wstools using an ant script, which is shown below (I have copied it directly, as I don't have too much time to edit it - sorry !):

          <project name="wsWSDLbuild" default="buildAll">
           <!-- Use some fixed properties that will depend on the installation -->
           <property file="genFromWSDL.properties"/>
           Required files to run wstools properly (list taken from wstools.sh supplied with the
           JBoss installation and those not absolutely required (found by trial-and-error) have
           been removed (I like to know what is really needed, rather than blindly putting every
           jar in the world here)
           <path id="jboss.wstools">
           <fileset dir="${jboss.root}/client">
           <include name="activation.jar"/>
           <include name="javassist.jar"/>
           <include name="jbossall-client.jar"/>
           <include name="jbossretro-rt.jar"/>
           <include name="jboss-backport-concurrent.jar"/>
           <include name="jbossws-client.jar"/>
           <include name="mail.jar"/>
           <fileset dir="${jboss.root}/lib/endorsed">
           <include name="xercesImpl.jar"/>
           Make up a path for wstools that also includes this projects's class
           base directory (only the base directory is needed or the files will
           not be found)
           <path id="jboss.wstools.plus.project">
           <path refid="jboss.wstools"/>
           <pathelement path="${class.dir}"/>
           Set up the class file for wstools and ensure that the task will have the
           correct classpath that includes both the wstools required files and also
           the class files from this project
           <taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
           <classpath refid="jboss.wstools.plus.project"/>
           Build SequenceService
           <target name="buildSequenceService">
           <echo message="SequenceService"/>
           <wstools dest="${generated.WSDL.output}"
           <echo message="Done SequenceService"/>
           Build TestingService
           <target name="buildTestingService">
           <echo message="TestingService"/>
           <wstools dest="${generated.WSDL.output}"
           <echo message="Done TestingService"/>
           Run wstools on the specified configuration file and generate all the necessary
           artefacts as specified in that file
           <target name="buildAll" depends="buildSequenceService,buildTestingService">
           <echo message="Built both"/>

          The properties file just contains some common property values:

          # Where jboss is installed
          # Lots of information about the project and the various required locations for classes
          # and configuration files etc.
          # Directory the generated code should be based from

          I run all this from within Eclipse, but it should all run from the command line or whatever.

          Hope this is of some help.



          • 2. Re: How to generate mapping.xml & webservices.xml from WSDL?
            Elise Wade Newbie

            Ok. This is exactly the information I need. I too wish to generate java stubs from a wsdl with wstools. I appreciate the sample configuration file. I am generating stubs, but I wonder what is in the mapping file?

            • 3. Re: How to generate mapping.xml & webservices.xml from WSDL?
              Dominic Campbell Newbie


              The mapping file contains details that allows de/serialisation between Java types and the XML types secified in your web service. You can look at it in any text editor or an XML browser etc.

              It is documented here: http://www-128.ibm.com/developerworks/webservices/library/ws-jaxrpc1/

              and also in lots of other places, search for "jaxrpc mapping" to get starting places to look.



              • 4. Re: How to generate mapping.xml & webservices.xml from WSDL?
                Amit Sri Newbie


                Infact wscompile tool which comes with JWSDP 2.0, generated all the required artifacts.
                For details please refer to http://java.sun.com/webservices/docs/1.6/jaxrpc/jaxrpc-tools.html

                Thanks again,
                Amit Srivastava..