-
1. Re: How to generate mapping.xml & webservices.xml from WSDL?
docampbell Sep 12, 2006 7:10 AM (in response to amit_sri)Hi,
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"> <global> <package-namespace package="itag.wswg.rm.services.ss" namespace="http://itag.wswg.rm"/> </global> <wsdl-java file="C:/AllStuff/eclipse/jbossWorkspace/webby/resources/WSDL/SequenceService.wsdl"> <mapping file="itag/wswg/rm/SequenceService-mapping.xml" /> </wsdl-java> </configuration>
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> <fileset dir="${jboss.root}/lib/endorsed"> <include name="xercesImpl.jar"/> </fileset> </path> <!-- 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}"/> </path> <!-- 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"/> </taskdef> <!-- Build SequenceService --> <target name="buildSequenceService"> <echo message="SequenceService"/> <wstools dest="${generated.WSDL.output}" config="${config.dir}/SequenceServiceWSDLconfig.xml" verbose="true"/> <echo message="Done SequenceService"/> </target> <!-- Build TestingService --> <target name="buildTestingService"> <echo message="TestingService"/> <wstools dest="${generated.WSDL.output}" config="${config.dir}/TestingServiceWSDLconfig.xml" verbose="true"/> <echo message="Done TestingService"/> </target> <!-- 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"/> </target> </project>
The properties file just contains some common property values:# Where jboss is installed # jboss.root=C:/AllProgs/jboss-4.0.4.GA # Lots of information about the project and the various required locations for classes # and configuration files etc. # eclipse.root=C:/AllStuff/eclipse/jbossWorkspace project.name=webby project.root=${eclipse.root}/${project.name} class.dir=${project.root}/bin config.dir=${project.root}/resources/wsbuild # Directory the generated code should be based from # generated.output=${project.root}/gensrc generated.WSDL.output=${project.root}/genWSDLsrc
I run all this from within Eclipse, but it should all run from the command line or whatever.
Hope this is of some help.
Cheers,
Dominic. -
2. Re: How to generate mapping.xml & webservices.xml from WSDL?
ewade Sep 12, 2006 1:41 PM (in response to amit_sri)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?
docampbell Sep 13, 2006 6:32 AM (in response to amit_sri)Hi,
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.
Cheers,
Dominic. -
4. Re: How to generate mapping.xml & webservices.xml from WSDL?
amit_sri Sep 15, 2006 1:23 PM (in response to amit_sri)Thanks...
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..