Glenn,

Thanks for the suggestions. Axis was definitely generating an implementation for
me and ignoring my implementation.  After much trial and error, I've gotten
things to work the way I want, and I've included the Ant tasks below in case
someone sees a better way to do it.  

Remember, my goal was to allow the developer to write a single .java
implementation, and have everything else automated with respect to web service
creation and deployment.  I generally accomplish this goal below, though at this
point I've had to write two .java classes--an interface and an implementation.

Here are my Ant tasks:

<!-- 
Generate the WSDL file. 
-->
<axis-java2wsdl classname="${wsapi.package}.Math" 
    location="${wsapi.url}/Math"
    namespace="${wsapi.namespace}"
    output="${build.home}/WEB-INF/classes/${wsapi.path}/Math.wsdl">
    <classpath>
        <pathelement location="${build.home}/WEB-INF/classes"/>
    </classpath>
    <mapping namespace="${wsapi.namespace}" package="${wsapi.package}"/>
</axis-java2wsdl>

<!-- 
Move my implementation source files over. 
-->
<copy todir="${build.home}/WEB-INF/classes/${wsapi.path}">
    <fileset dir="${basedir}/${app.name}/WEB-INF/classes/${wsapi.path}/impl"
    includes="*.java" />
</copy>

<!-- 
Generate web services sources, but don't overwrite my implementation file. 
-->
<axis-wsdl2java output="${build.home}/WEB-INF/classes" 
    deployscope="Application" serverside="true"
    url="${build.home}/WEB-INF/classes/${wsapi.path}/Math.wsdl"
    implementationClassName="${wsapi.package}.MathImpl">
</axis-wsdl2java>

<!-- 
Compile everything. 
-->
<javac srcdir="${build.home}/WEB-INF/classes/${wsapi.path}"
    destdir="${build.home}/WEB-INF/classes"
    debug="${compile.debug}" deprecation="${compile.deprecation}"
    optimize="${compile.optimize}">
    <classpath refid="compile.classpath"/>
</javac>

<!-- 
Generate the Axis server-config.wsdd file. 
-->
<java classname="org.apache.axis.utils.Admin" classpathref="compile.classpath">
    <arg value="server" />
    <arg file="${build.home}/WEB-INF/classes/${wsapi.path}/deploy.wsdd" />
</java>
<move file="${basedir}/server-config.wsdd" todir="${build.home}/WEB-INF" />

Maybe I've gone about this all wrong, but this process makes the most sense to
me.  Any comments are welcome.

Thanks again.

Jay


-----Original Message-----
From: glenn bech [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 27, 2006 3:13 AM
To: [email protected]
Subject: RE: Deploying a web service

Hi,

Your problem may be that the generated deploy.wsdd contains <service> tags
with <parameter name="className" value="someDefaultImplementationClass".

Look into the generated server-config.wsdd and check what this value is.

My guess is that you have Axis-generated classes for web-service
implementations. 

This explains your -3 behaviour as well, since Axis generated service
implementations return -3 for all int return values by default (so I've
understood it). 

You probably need an extra pass in your build script, after running 

<java classname="org.apache.axis.utils.Admin"
classpathref="compile.classpath">
    <arg value="server" />
    <arg file="my deploy.wsdd file" />
</java>

That searches for 

<parameter name="className" value="someDefaultImplementationClass".

And replaces it with 

<parameter name="className" value="YourWebServiceImplementaitonClass".

I almost started something like this; But then I came into a situation where
I was required to define a WSDL with more than one service. That messed
things up a bit :)

Hope this helps.

Glenn Richard Bech


-----Original Message-----
From: Jay Burgess [mailto:[EMAIL PROTECTED] 
Sent: 26. januar 2006 20:55
To: [email protected]
Subject: RE: Deploying a web service

Reading the WidgetPrice example in the Axis User Guide, it notes that the
developer needs to modify the Impl file "to add your implementation".  But
isn't
there a way, using Ant, that allows you to start with the implementation?  

My build.xml currently does the following, because I thought it should work:

<!-- Generate the .WSDL file -->
<axis-java2wsdl classname="my .java source file" ...>
...
</axis-java2wsdl>

<!-- Create the .java files -->
<axis-wsdl2java url="my .wsdl file" ...>
...
</axis-wsdl2java>

<!-- Compile the .java files -->
<javac srcdir="path to the .java files generated in previous step"...>
...
</javac>

<!-- Create server-config.wsdd -->
<java classname="org.apache.axis.utils.Admin"
classpathref="compile.classpath">
    <arg value="server" />
    <arg file="my deploy.wsdd file" />
</java>
 
I'm still missing something, but my goal is to have the developers create
.java
implementations, then allow Ant to build and deploy the web services within
my
existing webapp.

Thanks.

Jay


-----Original Message-----
From: Jay Burgess [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 26, 2006 11:17 AM
To: [email protected]
Subject: RE: Deploying a web service

After incorporating a <java> call to the Admin class in my build.xml, I now
have
a correct server-config.wsdd file being created.  And calling my webservice
via
a browser does return a SOAP message.  However...the result is always -3!

<soapenv:Envelope>
    <soapenv:Body>
        <addResponse
         soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
            <addReturn xsi:type="xsd:int">-3</addReturn>
        </addResponse>
    </soapenv:Body>
</soapenv:Envelope>

Since my implementation class looks like the following, I'd expect the
result to
be the sum of my two query string parameters:

public class Math
{
    public int add(int x, int y)
    {
        return x + y;
    }
}

I do see some hardcoded -3's in the Axis source, but haven't figured out
from
that what I'm doing wrong.  And since I can't seem to find a way to search
the
archives and Google for "-3", I'm not getting any help that way.

Does anyone have an idea about what I'm still doing wrong and/or what a -3
might
indicate?

Thanks.

Jay

----------------------------------------------------------------------------
----
From: Jim Azeltine [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 25, 2006 9:33 PM
To: [email protected]
Subject: Re: Deploying a web service


I am somewhat of a noob myself, but I am starting to "get it". You need to
look
for "embedded+axis" when you are searching. I found a couple of references
for you:
http://cephas.net/blog/2005/09/13/update_to_embedded_axis_application_in_tom
cat.html

Here is the install guide on it:
http://ws.apache.org/axis/java/install.html#AdvancedInstallationAddingAxisTo
YourOwnWebapp
I think this line is pertinent for you:
Run the Axis AdminClient against your own webapp, instead of Axis, by
changing
the URL you invoke it with.

I am just curious, why do you need to add axis to your app instead of the
opposite?

Jim

Jay Burgess <[EMAIL PROTECTED]> wrote:
I must be missing something obvious, but even after checking the list
archives,
etc., I still can't seem to get this to work. Here's my situation:

I have an existing webapp being deployed to Tomcat 5.0.19 as a .WAR. I'm
trying
to add a test web service to it (the Math sample delivered with Axis 1.3).
At
this point, I've done the following:

(1) Added the Axis servlet to my app's web.xml:

AxisServlet
Apache-Axis Servlet
org.apache.axis.transport.http.AxisServlet


(2) Mapped web service requests to the servlet:

AxisServlet
/wsapi/*


(3) Updated my build.xml to use and to
generate what I think are all the correct files into my .WAR: Add.class,
Add.java, Add.wsdl, AddService.java, AddServiceLocator.java,
AddSoapBindingImpl.java, AddSoapBindingStub.java, deploy.wsdd,
undeploy.wsdd.

(4) Included all the required .JARs in Tomcat/common/lib and my webapp's
WEB-INF/lib directory.

The AxisServlet seems to be running, but when I try to hit
"http://localhost/mywebapp/wsapi/Add";, I get back:

AXIS error
No service is available at this URL

I feel like my webapp hasn't really "deployed" the web service, but I'm not
sure
what I need to to to make that happen automatically as part of my webapp's
Ant
build/deploy process. 

Do I still need to include the AdminServlet somehow? Obviously, my goal is
to
put as little of Axis in my webapp as possible, and I thought I got that by
simply including the .JARs, but not happyaxis.jsp, etc.

Thanks in advance.

Jay

| Jay Burgess [Vertical Technology Group]
| http://www.vtgroup.com/


Reply via email to