xFire和spring集成成功了...但是遗留了个问题。求解

Vinyeah Vinyeah 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
测试代码用的是xfire自带的demo里的book。按照demo原有方式部署完以后。客户端调用正常。现尝试把xfire集成到spring里。
web.xml配置如下:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<servlet>
<servlet-name>SpringContextServlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>


<servlet>
<servlet-name>XFireServlet</servlet-name>
<display-name>XFire Servlet</display-name>
<servlet-class>
org.codehaus.xfire.spring.XFireSpringServlet
</servlet-class>
</servlet>


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



spring的配置如下:
<beans>
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />

<bean id="baseWebService"
class="org.codehaus.xfire.spring.remoting.XFireExporter"
lazy-init="false" abstract="true">
<property name="serviceFactory" ref="xfire.serviceFactory" />
<property name="xfire" ref="xfire" />
</bean>

<bean id="bookService" parent="baseWebService">
<property name="serviceBean" ref="bookServiceImpl" />
<property name="serviceClass"
value="org.codehaus.xfire.demo.BookService" />
</bean>

<bean id="bookServiceImpl"
class="org.codehaus.xfire.demo.BookServiceImpl" />
</beans>



所用到的服务接口;
public interface BookService
{
public Book[] getBooks();
public Book findBook(String isbn) throws BookException;
public Map getBooksMap();
}

部署以后服务正常启动。客户端调用getBooks()能正常返回,但是调用getBooksMap的时候,返回的map始终size为0.

相同的代码,按照xfire的demo中用org.codehaus.xfire.transport.http.XFireConfigurableServlet部署的话, getBooksMap能正常返回数据.


求解....
...全文

相关推荐

XFire 和spring完整集成实例

package com.xfire.core.client; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.codehaus.xfire.client.XFireProxyFactory; import org.codehaus.xfire.service.Service; import org.codehaus.xfire.service.binding.ObjectServiceFactory; import com.xfire.core.entity.UserInfo; import com.xfire.core.service.IUserInfoService; /** *@author jilongliang *@Date 2012-3-5 * */ public class UserInfoClient { public static void main(String[] args) { getServiceList(); setServiceList(); } static String url = "http://localhost:8081/xfire/services/UserInfo"; /** * */ public static void getServiceList() { Service service = new ObjectServiceFactory() .create(IUserInfoService.class); try { IUserInfoService iAddressService = (IUserInfoService) new XFireProxyFactory() .create(service, url); List list = (ArrayList) iAddressService .getAddressList(); System.out.println("一共多少条数据:" + list.size()); for (Iterator iter = list.iterator(); iter.hasNext();) { UserInfo a = iter.next(); System.out.println(a); } } catch (MalformedURLException e) { e.printStackTrace(); } } public static void setServiceList() { Service service = new ObjectServiceFactory() .create(IUserInfoService.class); try { IUserInfoService iAddressService = (IUserInfoService) new XFireProxyFactory() .create(service, url); List listAdd = new ArrayList(); UserInfo address = new UserInfo(); address.setIdentifier(1); address.setCountry("中國"); address.setProivice("廣東省"); address.setCity("陽江"); address.setAddress("廣東陽春"); address.setPostCode("1111111"); address.setExist(false); address.setArrary(new String[] { "22", "23", "24" }); listAdd.add(address); address.setIdentifier(2); address.setCountry("中國"); address.setProivice("廣東省"); address.setCity("陽江"); address.setAddress(

jilongliang

XFire和spring集成设置

XFire和spring集成设置,自己写的一个小DEMO,

zh326228

xFire与Spring集成

xFire与Spring集成xFire与Spring集成xFire与Spring集成xFire与Spring集成xFire与Spring集成

runbeck

spring集成xfire教程

NULL 博文链接:https://devil13th.iteye.com/blog/756419

weixin_38669628

spring 集成xfire 比较好的一种方式

spring xfire spring 集成xfire 比较好的一种方式

zzcfront
评论 9
收藏 已收藏
分享
返回顶部
Vinyeah
Java EE 67,535 成员 225,843 内容