在Tomcat中部署Axis 2并以自定义路径访问Web服务 [英] Deploy Axis 2 in Tomcat and access your web service in a custom path

查看:68
本文介绍了在Tomcat中部署Axis 2并以自定义路径访问Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Axis2的Web服务,该服务已在Tomcat中部署.首先,我下载了axis2.war&将其放置在Tomcat的webapps文件夹中.创建了axis2文件夹&它的子文件夹.在Axis2的WEB-INF子文件夹中,在services子文件夹中,放置.aar文件.然后在浏览器中,访问

I have an Axis2 based web service which I deployed in Tomcat.First I downloaded axis2.war & placed it in Tomcat's webapps folder.It created axis2 folder & its sub-folders.In the WEB-INF sub-folder of Axis2, in the services sub-folder I place my .aar file.Then in my browser I go to http://localhost:8080/axis2. It has a link services, which lists out all the services.Suppose my service is HelloWorldService. So the path where it is accessible is

http://localhost:8080/axis2/services/HelloWorldService

但是我不想向世界透露我的Web服务是由Axis2驱动的.假设我希望路径为

But I do not want to reveal to world that my web service is driven by Axis2. Suppose I want the path to be

http://localhost:8080/abc/services/HelloWorldService

该怎么做?我是否必须将axis2文件夹重命名为abc.我还在同一个Tomcat中部署了一个Web应用程序abc.是否将axis2子文件夹的内容复制到abc.我尝试过,没有用.

How to do that? Do I have to rename axis2 folder to abc. I also have an web application abc deployed in the same Tomcat. Do I copy content of axis2 sub-folder to abc. I tried that, did not work.

推荐答案

我还在同一个Tomcat中部署了一个Web应用程序abc.是否将axis2子文件夹的内容复制到abc.

I also have an web application abc deployed in the same Tomcat. Do I copy content of axis2 sub-folder to abc.

您正在考虑正确的方向,是的,您必须将Axis2.war的所有内容(不需要100%,但最好从头开始)复制到abc,除了web.xml.

You're thinking in right direction and yes, you have to copy all content(100% is not required, but its better you do it to start with) of the Axis2.war to abc except web.xml.

您必须将axis2.war/WEB-INF/web.xml内容与abc/WEB-INF/web.xml合并,方法是分别将以下内容分别复制到<web-app> XML标记内.

You have to merge, axis2.war/WEB-INF/web.xml content with abc/WEB-INF/web.xml, by copying following to respectively inside <web-app> XML tag.

    <servlet>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-name>AxisServlet</servlet-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <!--<init-param>-->
        <!--<param-name>axis2.xml.path</param-name>-->
        <!--<param-value>/WEB-INF/conf/axis2.xml</param-value>-->
        <!--<param-name>axis2.xml.url</param-name>-->
        <!--<param-value>http://localhost/myrepo/axis2.xml</param-value>-->
        <!--<param-name>axis2.repository.path</param-name>-->
        <!--<param-value>/WEB-INF</param-value>-->
        <!--<param-name>axis2.repository.url</param-name>-->
        <!--<param-value>http://localhost/myrepo</param-value>-->
        <!--</init-param>-->
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <display-name>Apache-Axis AxisAdmin Servlet (Web Admin)</display-name>
        <servlet-name>AxisAdminServlet</servlet-name>
        <servlet-class>org.apache.axis2.webapp.AxisAdminServlet</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>*.jws</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>AxisAdminServlet</servlet-name>
        <url-pattern>/axis2-admin/*</url-pattern>
    </servlet-mapping>

希望它对您有用!如果不起作用,请更新您的问题,我可以重新调整答案.

Hope it works for you! If it doen't work update your question and I could refocus the answer.

这篇关于在Tomcat中部署Axis 2并以自定义路径访问Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆