如何在myeclipse添加xfire servlet和service.xml文件
1个回答
2015-06-09
展开全部
web.xml 添加
<!-- begin XFire 配置 -->
<servlet>
<servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>xfire</servlet-name>
<url-pattern>*.ws</url-pattern>
</servlet-mapping>
<!-- 配合Spring容器中XFire一起工作的Servlet-->
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
xfire-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 引入XFire预配置信息 -->
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
<!-- 定义访问的url -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/webservices.ws">
<ref bean="webservices" />
</entry>
</map>
</property>
</bean>
<!-- 使用XFire导出器 -->
<bean id="baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false" abstract="true">
<!-- 引用xfire.xml中定义的工厂 -->
<property name="serviceFactory" ref="xfire.serviceFactory" />
<!-- 引用xfire.xml中的xfire实例 -->
<property name="xfire" ref="xfire" />
</bean>
<bean id="webservices" parent="baseWebService">
<!-- 业务服务bean -->
<property name="serviceBean" ref="webservicesService" />
<!-- 业务服务bean的窄接口类 -->
<property name="serviceClass" value="com.seavision.huayi2.service.IWebservice" />
</bean>
</beans>
还是建议使用cxf。
<!-- begin XFire 配置 -->
<servlet>
<servlet-name>xfire</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>xfire</servlet-name>
<url-pattern>*.ws</url-pattern>
</servlet-mapping>
<!-- 配合Spring容器中XFire一起工作的Servlet-->
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/servlet/XFireServlet/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
xfire-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 引入XFire预配置信息 -->
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
<!-- 定义访问的url -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/webservices.ws">
<ref bean="webservices" />
</entry>
</map>
</property>
</bean>
<!-- 使用XFire导出器 -->
<bean id="baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false" abstract="true">
<!-- 引用xfire.xml中定义的工厂 -->
<property name="serviceFactory" ref="xfire.serviceFactory" />
<!-- 引用xfire.xml中的xfire实例 -->
<property name="xfire" ref="xfire" />
</bean>
<bean id="webservices" parent="baseWebService">
<!-- 业务服务bean -->
<property name="serviceBean" ref="webservicesService" />
<!-- 业务服务bean的窄接口类 -->
<property name="serviceClass" value="com.seavision.huayi2.service.IWebservice" />
</bean>
</beans>
还是建议使用cxf。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询