xfire生成webservice

1.web.xml

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

<web-app 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>XFireWebservice</display-name>

<!-- Spring配置 -->        

  <context-param> 

                <param-name>contextConfigLocation</param-name> 

                <param-value>classpath:org/codehaus/xfire/spring/xfire.xml,classpath:applicationContext.xml</param-value> 

        </context-param> 

 

  <listener>     

        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>     

  </listener>        

  <!-- XFire 配置 -->     

  <servlet>     

        <servlet-name>xfireServlet</servlet-name>     

        <servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>     

  </servlet>     

  <servlet-mapping>     

        <servlet-name>xfireServlet</servlet-name>        

        <url-pattern>/service/*</url-pattern>     

  </servlet-mapping>

</web-app>

2.在classpath下新建applicationContext.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"

       xsi:schemaLocation="

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

 

 

<bean id="sendMailService" class="com.deng.webservice.first.SendEmailImpl" /> 

 

  <bean id="sendMail" class="org.codehaus.xfire.spring.ServiceBean"> 

    <property name="serviceBean" ref="sendMailService" /> <!-- 实现 -->

    <property name="serviceClass" value="com.deng.webservice.first.SendEmail" /> <!-- 接口 -->

 

    <property name="inHandlers"> 

      <list> 

        <ref bean="addressingHandler" /> 

      </list> 

    </property> 

  </bean> 

 

  <bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler" /> 

  </beans>

3.依赖的jar包

   commons-beanutils-1.7.0.jar

   commons-codec-1.3.jar

   commons-httpclient-3.0.jar

   commons-logging-1.0.4.jar

   jdom-1.0.jar

   spring.jar

   wsdl4j-1.6.1.jar

   xfire-all-1.2.6.jar

 4.如何访问

   http://localhost:8080/${工程名}/service/SendEmail?wsdl

    http://localhost:8080/${工程名}/service/

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值