• Axis2 1.7.4构建项目


    1.下载axis2项目文件

    http://axis.apache.org/axis2/java/core/download.html

    2.Maven文件的pom.xml文件

    3.将下载的axis2-1.7.4-war.zip下的axis2.war目录中WEB-INF文件夹里的复制代码

     
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:web="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
    
      <display-name>Archetype Created Web Application</display-name>
      <servlet>
          <servlet-name>AxisServlet</servlet-name>
          <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
          <init-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>classpath:conf/axis2.xml</param-value>
          </init-param>
          <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
          <servlet-name>AxisServlet</servlet-name>
          <url-pattern>url-pattern>
      </servlet-mapping>
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring-context*.xml</param-value>
      </context-param>
      <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>
      <listener>
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
      </listener>
      <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
      </listener>
      <filter>
        <filter-name>charEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
          <param-name>encoding</param-name>
          <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
          <param-name>forceEncoding</param-name>
          <param-value>true</param-value>
        </init-param>
      </filter>
      <filter-mapping>
        <filter-name>charEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
    </web-app>
    复制代码
     

    5.spring-context.xml

    复制代码
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
        xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
        xmlns:aop="http://www.springframework.org/schema/aop" 
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
        http://www.springframework.org/schema/jee 
        http://www.springframework.org/schema/jee/spring-jee-3.0.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd 
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
        <context:annotation-config/>
        <context:component-scan base-package="包名">
            <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
        </context:component-scan>
        <bean id="propertyConfigurer"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:controller.properties</value>
                </list>
            </property>
        </bean>
    </beans>
    复制代码

    6.创建java的接口和实现。

    public interface HelloService {
        public String say(String text);
    }

    7.创建services.xml文件

    8.services.xml内容

    复制代码
    <?xml version="1.0" encoding="UTF-8"?>
    <service name="HelloService" targetNamespace="http://tempuri.org/">
        <description>web service</description>
        <schema schemaNamespace="http://tempuri.org/"/>
        <parameter name="ServiceObjectSupplier">
            org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
        </parameter>
        <parameter name="helloService</parameter>
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
                class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
                class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
        </messageReceivers>
    </service>
    复制代码

    9.访问路径 http://localhost:8080/test/services/HelloService?wsdl

  • 相关阅读:
    css 媒体查询
    Centos7将/dev/mapper/centoshome磁盘空间转移到/dev/mapper/centosroot
    MySQL查看锁表的状态命令
    域控机器 共享文件目录无法用IP访问
    第一篇 川川
    用cmp,还是重载‘<’、‘>’、‘==’、‘!=’ 川川
    这几周在实现一个简单词法器的过程中所学的 川川
    Spring 自定义注解
    十大排序算法
    堆排序
  • 原文地址:https://www.cnblogs.com/firstdream/p/6394317.html
Copyright © 2020-2023  润新知