Hi,

I've started working with Axis for the past weeks, and I've been trying
to implement a webapp that allows me to list and do deployments and
undeployments without having to use the command line. (interesting for
remote servers).

I've been trying to do it with AdminClient class that I've found in the
API, but I'm having some problems...

I've followed the instructions on placing axis inside a webapp. I placed
the necessary jars inside WEB-INF/lib and altered web.xml to have the
necessary servlet and servlet-mappings entries. I've also copied the
server-config.wsdd in axis to WEB-INF.

I built a servlet with two buttons deploy and undeploy, the first time I
access it, I can do deploy but if I try to do undeploy nothing happens.
One curious thing is that the deploy service remains there even after
several restarts and after some time the service disappears.

So at this point I'm thinking if this is the right approach? Should this
be done? And if yes is this the right class to use?

This is part of the code I'm using for deploy/undeploy

AdminClient admClient;
admClient = new AdminClient();
URL url = new URL ("http://localhost:8080/Teste/services/Teste";);
admClient.setTargetEndpointAddress(url);
//admClient.setTransport("http");
                
String command = request.getParameter("command");

if (command != null) {
        File wsdd = null;
        if ("deploy".equals(command)) {
        wsdd = new File(home+"WEB-INF/deploy.wsdd");
        admClient.process(new FileInputStream(wsdd));
} else if ("undeploy".equals(command)) {
        wsdd = new File(home+"WEB-INF/undeploy.wsdd");
        admClient.process(new FileInputStream(wsdd));
}

Below are the web.xml and server-config.wsdd deploy.wsdd and undeploy.wsdd.

I'm using eclipse 3.1.2 to write the code, Tomcat 5.5 axis1.3 and java
1.5.0_06

Thanks in advance,
Pedro Silva

My *deploy.wsdd* :

<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
 <service name="Teste" provider="java:MSG">
  <parameter name="className" value="teste.Teste"/>
  <parameter name="allowedMethods" value="*"/>
 </service>
</deployment>

My *undeploy.wsdd* :

<undeployment xmlns="http://xml.apache.org/axis/wsdd/";>
 <service name="Teste"/>
</undeployment>


*My web.xml* :

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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";>
<display-name>Teste</display-name>
<servlet>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-name>AxisServlet</servlet-name>
        <servlet-class>
                org.apache.axis.transport.http.AxisServlet
        </servlet-class>
</servlet>
<servlet>
        <display-name>Axis Admin Servlet</display-name>
        <servlet-name>AdminServlet</servlet-name>
        <servlet-class>
                org.apache.axis.transport.http.AdminServlet
        </servlet-class>
        <load-on-startup>100</load-on-startup>
</servlet>
<servlet>
        <description>
        </description>
        <display-name>
        AdminTeste</display-name>
        <servlet-name>AdminTeste</servlet-name>
        <servlet-class>
        teste.AdminTeste</servlet-class>
</servlet>
<servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
        <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
        <servlet-name>AdminServlet</servlet-name>
        <url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
        <servlet-name>AdminTeste</servlet-name>
        <url-pattern>/AdminTeste</url-pattern>
</servlet-mapping>
<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>


My *server-config.wsdd* :


<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
 <globalConfiguration>
  <parameter name="sendMultiRefs" value="true"/>
  <parameter name="disablePrettyXML" value="true"/>
  <parameter name="adminPassword" value="admin"/>
  <parameter name="attachments.Directory"
value="/home/psilva/tomcat/webapps/axis/WEB-INF/attachments"/>
  <parameter name="dotNetSoapEncFix" value="true"/>
  <parameter name="enableNamespacePrefixOptimization" value="false"/>
  <parameter name="sendXMLDeclaration" value="true"/>
  <parameter name="sendXsiTypes" value="true"/>
  <parameter name="attachments.implementation"
value="org.apache.axis.attachments.AttachmentsImpl"/>
  <requestFlow>
   <handler type="java:org.apache.axis.handlers.JWSHandler">
    <parameter name="scope" value="session"/>
   </handler>
   <handler type="java:org.apache.axis.handlers.JWSHandler">
    <parameter name="scope" value="request"/>
    <parameter name="extension" value=".jwr"/>
   </handler>
  </requestFlow>
 </globalConfiguration>
 <handler name="LocalResponder"
type="java:org.apache.axis.transport.local.LocalResponder"/>
 <handler name="URLMapper"
type="java:org.apache.axis.handlers.http.URLMapper"/>
 <handler name="Authenticate"
type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
 <service name="AdminService" provider="java:MSG">
  <parameter name="allowedMethods" value="AdminService"/>
  <parameter name="enableRemoteAdmin" value="true"/>
  <parameter name="className" value="org.apache.axis.utils.Admin"/>
  <namespace>http://xml.apache.org/axis/wsdd/</namespace>
  <namespace>http://xml.apache.org/axis/wsdd/</namespace>
  <namespace>http://xml.apache.org/axis/wsdd/</namespace>
 </service>
 <service name="Version" provider="java:RPC">
  <parameter name="allowedMethods" value="getVersion"/>
  <parameter name="className" value="org.apache.axis.Version"/>
 </service>
 <transport name="http">
  <requestFlow>
   <handler type="URLMapper"/>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  </requestFlow>
  <parameter name="qs:list"
value="org.apache.axis.transport.http.QSListHandler"/>
  <parameter name="qs:wsdl"
value="org.apache.axis.transport.http.QSWSDLHandler"/>
  <parameter name="qs.list"
value="org.apache.axis.transport.http.QSListHandler"/>
  <parameter name="qs.method"
value="org.apache.axis.transport.http.QSMethodHandler"/>
  <parameter name="qs:method"
value="org.apache.axis.transport.http.QSMethodHandler"/>
  <parameter name="qs.wsdl"
value="org.apache.axis.transport.http.QSWSDLHandler"/>
 </transport>
 <transport name="local">
  <responseFlow>
   <handler type="LocalResponder"/>
  </responseFlow>
 </transport>
</deployment>



Reply via email to