问题描述
- xfire 客户端没有等待服务端返回,就向下执行,这样导致客户端获取不到返回值
-
服务端配置:<bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInHandler" /> <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <list> <value>webServiceForPlaceRemote</value> </list> </property> </bean> <bean id="placeManager" class="com.rainsoft.yunReg.manage.PlaceManager" /> <!-- 场所编码生成,获取场所信息接口 --> <bean name="webServiceForPlaceRemote" class="org.codehaus.xfire.spring.ServiceBean"> <property name="serviceBean" ref="placeManager"></property> <property name="serviceClass" value="com.rainsoft.app.webservice.interfaces.WebServiceForPlace"></property> <property name="inHandlers"> <list> <ref bean="addressingHandler" /> </list> </property> </bean>
客户端调用:
String url = "http://localhost:8080/yun_reg/service/WebServiceForPlace"; serviceFactory = new ObjectServiceFactory(); Service serviceModel = serviceFactory.create(WebServiceForPlace.class); WebServiceForPlace service=null; try { service = (WebServiceForPlace) new XFireProxyFactory().create(serviceModel,url); Map actionValues = new HashMap(); actionValues.put("areaCode", "342422"); actionValues.put("businessNature", "1"); actionValues.put("serviceType", "1"); String placeCode = service.savePlaceAndReturnPlaceCode(actionValues); System.out.println(placeCode); Map place = service.getPlace("65232810000001"); System.out.println(placeCode); } catch (MalformedURLException e) { e.printStackTrace(); }
服务端代码是执行了,但是客户端打印的都是null。客户端直接向下执行,并不会等待服务端执行结束
时间: 2024-11-08 20:25:03