[jboss-user] [JBossWS] - Re: beginner needs help

vitor_b do-not-reply at jboss.com
Mon Mar 26 06:39:57 EDT 2007


Sorry for such a long time you had to wait for my reply.

First thing you need is: JWSDP (Java Web Services Developer Pack). You can download it from www.sun.com. I use jwsdp-1.4.

And here it is ant task which will generate for you jaxrpc-mapping and wsdl files:

First we need to set path to JWSDP:

	<property name="jwsdp.dir" value="<your path>\jwsdp-1.4" />
  | 	<property name="classes.dir" value="<compiled classes>\bin" />

Replace values in <> to your specific ones.

Now we have to specify jar libraries we will use:

	 <path id="jwsdp.lib.path">
  | 	        <fileset dir="${jwsdp.dir}/jwsdp-shared">
  | 	            <include name="**/*.jar"/>
  | 	        </fileset>
  | 	        
  | 	        <fileset dir="${jwsdp.dir}/jaxrpc">
  | 	            <include name="**/*.jar"/>
  | 	        </fileset> 
  | 	        
  | 	        <fileset dir="${jwsdp.dir}/saaj">
  | 		     <include name="**/*.jar"/>
  | 	        </fileset>
  | 	 </path>

We need one more library (we need class com.sun.tools.javac.Main):

	<path id="wscompile.task.classpath">
  | 		<path refid="jwsdp.lib.path"/>
  | 		<fileset dir="${java.home}/../lib" includes="tools.jar"/>
  | 	</path>


Now we define our own ant task:

<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile" classpathref="wscompile.task.classpath"/>

And we run it:

     <target name="run-wscompile" depends="xdoclet-build">
  | 	<wscompile base="${res-generated-dir}"
  | 	        fork="true"
  | 	        server="true"
  | 	        features="rpcliteral"
  | 	        mapping="${res-gen-ws}/jaxrpc-mapping.xml"
  | 	        config="${res-hand-made-dir}/wscompile-config.xml"
  | 	        nonClassDir="${res-gen-ws}">
  | 	            
  | 	        <classpath>
  | 	        	<path refid="wscompile.task.classpath"/>
  | 	                <pathelement location="${classes.dir}"/>
  | 	        </classpath>
  | 
  | 	</wscompile>
  |      </target>

res-gen-ws and res-hand-made-dir are my dirs.
res-gen-ws is the directory which will contain generated jaxrpc-mapping and wsdl files. But wscompile task needs one more thing: wscompile-config.xml

This file contains info which will be used for generating files for you.
My file looks like that: 

<?xml version="1.0" encoding="UTF-8"?>
  | <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
  |   <service name="NameWebService"
  |            targetNamespace="http://localhost:8080/jmsprototype"
  |            typeNamespace="http://localhost:8080/jmsprototype/types"
  |            packageName="ws.bean">
  |     <interface name="ws.bean.WebService"/>
  |   </service>
  | </configuration>

packageName - package contains web service classes
Element interface contains WebService class, that implements interface java.rmi.Remote.

service name - name for service in wsdl file 
<service name="NameWebService">

You still have to create webservices.xml file yourself. But that is not a very hard thing to do. 

If you have any questions just ask.
I will check this topic later.

Take care

vitor_b






View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031523#4031523

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031523



More information about the jboss-user mailing list