江湖开发者 | Java粉
网站地图
首页> Java> ​axis2 发布webservices
2016
05-02

​axis2 发布webservices

axis2 发布webservice


axis2 下载地址:http://www-us.apache.org/dist/axis/axis2/java/core/1.7.1/

1.  解压axis2-1.7.1-war.zip   复制 lib ,moduals, conf 到 WEB-INF下。

2.  在 WEB-INF /services/ProjectName/META-INF/services.xml

U7~L44UWNF`V.png

3. web.xml

1

2

3

4

5

6

7

8

9

10

11

12

<!--Axis2 config start-->

        <servlet>

            <servlet-name>AxisServlet</servlet-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

 

  <!--Axis2 config end-->


4. 接口类

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

package com.jhkz.services;

 

public class HelloWorld {

     

    public String sayHello(){

         

        return "Hello World!";

    }

     

    public String sayThink(String ask){

         

        return ask;

    }

 

}

5. services.xml

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

<?xml version="1.0" encoding="UTF-8"?>

 

<service name="HelloWorld">  

    <description>  

        HelloWorld Service Example

    </description>  

    <parameter name="ServiceClass">  

        com.jhkz.services.HelloWorld

    </parameter>  

    <operation name="sayHello">  

        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />  

    </operation>  

    <operation name="sayThink">  

        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />  

    </operation>  

</service>

6. http://127.0.0.1:8080/webservices-axis2/services/HelloWorld?wsdl



Java江湖     
全部评论:

表情验证码,看不清楚,换一张

随机文章

云标签

公众号

微信

分享:分享我们的知识;专注:专注个人技术的提升;