You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jnedzel <jn...@broad.mit.edu> on 2007/05/02 21:10:51 UTC

embedding axis2 in a webapp and REST

I'm using axis2 v1.1.1

I'm embedding axis2 in my webapp following the example shown here:

http://www.redhat.com/magazine/021jul06/features/apache_axis2/

I'm following what the article calls "Use Case 2".  I've added the Axis 
servlet to my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     <welcome-file-list>
         <welcome-file>index.jsp</welcome-file>
         <welcome-file>index.html</welcome-file>
     </welcome-file-list>
     <servlet>
         <servlet-name>Gc3Servlet</servlet-name>
         <servlet-class>org.genecruiser.ui.Gc3Servlet</servlet-class>
     </servlet>
     <servlet-mapping>
         <servlet-name>Gc3Servlet</servlet-name>
         <url-pattern>/gc3Servlet</url-pattern>
     </servlet-mapping>
     <servlet>
     	<servlet-name>AxisServlet</servlet-name>
     	<display-name>Apache-Axis Servlet</display-name>
 
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
     	<load-on-startup>1</load-on-startup>
     </servlet>
     <servlet-mapping>
     	<servlet-name>AxisServlet</servlet-name>
     	<url-pattern>/services/*</url-pattern>
     </servlet-mapping>
</web-app>

---------------------
My services.xml is very simple:

<service name="GeneCruiser" scope="application">
   <description>Initial GeneCruiser gene service
   </description>
   <messageReceivers>
     <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" 	
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
     <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>		
   </messageReceivers>
   <parameter name="ServiceTCCL">composite</parameter>
   <parameter name="ServiceClass">org.genecruiser.service.GeneService
   </parameter>
</service>	
----------------------

I've included the axis2 jars in my webapp's WEB-INF/lib directory.

I can get to the WSDL using this URL and it looks fine:

http://localhost:8080/genecruiser3-0/services/GeneCruiser?wsdl

But I can't get to my REST service (defined using POJOs).  I was 
expecting to invoke find it using:

http://localhost:8080/genecruiser3-0/services/GeneCruiser/gene?id=52051

I have successfully deployed the same REST service code to an axis2 
webapp, but I need to combine my webapp and webservice in a single war file.

When I used the separate axis2 webapp, I had to edit 
axis2/conf/axis2.xml to enable REST.  But following the example shown 
above, there is no axis2.xml, so how do I set the "disableREST" 
parameter to false?

I've tried to get to the axis2 services list using:

http://localhost:8080/genecruiser3-0/services/listServices

but this returns a blank page.

I've looked at this example, which seems to add a <serviceGroup> tag to 
the XML (if I'm following it correctly).  Is this required as well?

Thanks,

Jared

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org