> In my build stubs tasks I have the following, and indeed the 
> stubs are built.
> 
> However, no classes are generated, nor source for the 
> classes: <java classname="org.apache.axis.wsdl.WSDL2Java" fork="yes">
>                       <arg value="-o"/>
>                       <arg value="${src.dir}"/>
>                       <arg value="${conf.dir}/Service1.wsdl"/>
>                       <arg value="-p"/>
>                       <arg value="stubs"/>
>                       <classpath>
>                               <path refid="axis.libraries"/>
>                       </classpath>
>               </java>
>       </target>
> 
The example was designed for working with an existing Web service, such
as the examples on xmethods...  With that being said -

When you run "ant compile", there is a dependency on stubs and stubs
depends on clean. Clean wipes out the classes and build directories (The
build directories are not even used in this case.)  When the code above
gets run, if in the conf.dir location, you have a wsdl file named
Service1.wsdl, then stubs wil be created.  The four java files will be
created in the stubs directory under source.  That's what the above says
- build and put the java files in the stubs package/directory.

The next dependency is compile that was in the build file.  Those lines
were:
                <javac srcdir="${src.dir}/stubs"
destdir="${classes.dir}" fork="true">
                        <classpath>
                                <path refid="all"/>
                        </classpath>
                </javac>

                <javac srcdir="${src.dir}/client"
destdir="${classes.dir}" fork="true">
                        <classpath>
                                <path refid="all"/>
                        </classpath>
                </javac>

This will compile the source in the src/stubs directory and in the
src/client directory.  You will find the classes in the classes\stubs
and classes\client directories.


Now off to running the example - 
> 
> This is in the compile task. Where do the name and classname 
> come from, and how does that relate to above: <target 
> name="clientService1stub.run" description="Run Service1 Stub">
>         <java classname="client.ClientService1Stub" fork="yes">
>             <classpath>
>                 <path refid="all"/>
>             </classpath>
>         </java>
>     </target>

The target is just what is called after the run command. So...
ant clientServicestub1.run  

This will run the class file ClientService1Stub that iws in the client
package/directory.  I am assuming that use created a file classed
ClientService1Stub.java that is a copy of the other examples.  After you
ran ant compile the first time, you will see the stub files that are
available in the src\stub directory.  Changing the names in the client
is pretty straight forward.

TemperatureServiceLocator serviceLocator = new
TemperatureServiceLocator();
TemperatureBindingStub stub =
(TemperatureBindingStub)serviceLocator.getTemperaturePort();

In this case the word "Temperature" would be exchanged for your service
name.  The only tricky part that I have run in to is the
getTemperaturePort() function may be different.  This is specific to
each web service.  This call can be found in the
<name>ServiceLocator.java code.


Hope this gets you closer.

Thanks,

Ken



Reply via email to