Thank you Azeez. Do you see anything wrong if I extended the Axis Servlet
instead?
public class ListServices extends AxisServlet {
...
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException {
StringBuffer output = new StringBuffer("<html><body><h1>Available
Services:</h1>");
int index = 1;
for (Iterator iter =
super.axisConfiguration.getServices().values().iterator(); iter.hasNext();){
AxisService service = (AxisService) iter.next();
output.append("<p>");
output.append(index).append(". ");
output.append("<a href=\"" + "services/" + service.getName() + "?wsdl\">");
output.append(service.getName());
output.append("</a>");
output.append("<p/>");
}
output.append("</body></html>");
try{
PrintWriter printWriter = response.getWriter();
printWriter.write(output.toString());
printWriter.flush();
printWriter.close();
} catch (IOException ex) {
// Make sure you log the exception, as it might be swallowed
//log.fatal("Initial axisConfig creation failed." + ex);
//throw new ExceptionInInitializerError(ex);
}
}
}
Thank you,
Radu
Afkham Azeez <[EMAIL PROTECTED]> wrote:
Simply calling the AxisServlet will not list services for you. One thing you
could do is write your own servlet to do this;
public class ListServicesServlet extends HttpServlet {
private AxisConfiguration axisConfig;
public void init() throws ServletException {
axisConfig =
ConfigurationContextFactory.createConfigurationContextFromFileSystem("path to
ur repo", "path to your axis2.xml").getAxisConfiguration();
}
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException {
StringBuffer output = new StringBuffer("<html><body><h1>Service
List</h1>");
int index = 1;
for (Iterator iter = axisConfig.getServices().values().iterator();
iter.hasNext();){
AxisService service = (AxisService) iter.next();
output.append(index).append(". ").append(service.getName());
}
output.append("</body></html>");
PrintWriter printWriter = response.getWriter();
printWriter.write(output.toString());
printWriter.flush();
printWriter.close();
}
}
HTH
Azeez
On Jan 22, 2008 9:56 PM, red dog <[EMAIL PROTECTED]> wrote:
Hello everyone,
I have 2 embedded axis 2 services in my web app. How can I list all the
available services? Invoking
http://localhost:8080/AppName/services/listServices returns an empty page.
Here is how i define the Axis Servlet in my web.xml:
<
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>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>listServices</url-pattern>
</servlet-mapping>
Thank you,
Radu
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
--
Thanks
Afkham Azeez
http://www.wso2.org
GPG Fingerprint: 643F C2AF EB78 F886 40C9 B2A2 4AE2 C887 665E 0760
---------------------------------
Never miss a thing. Make Yahoo your homepage.