论坛首页 综合技术论坛

xfire发布的url mapping 服务混淆。

浏览 1631 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-09-17   最后修改:2010-09-17
预发布后上线,发生了严重的事情,不同频道的东西竟然会调用相同的服务,

后来才发现原来是xfire的问题。。。我靠,以后要注意这一点


两个xfire serivce用的是同样的接口,但是实现类不同,如下:

	<bean id="hello" class="com.impl.HelloImpl" />
	<bean id="hello1" class="com.impl.HelloImpl1" />
	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="mappings">
			<props>
				<prop key="/helloService">helloService</prop>
				<prop key="/hello1Service">hello1Service</prop>
			</props>
		</property>
	</bean> 
	<bean id="helloService" class="org.codehaus.xfire.spring.remoting.XFireExporter">
		<property name="serviceFactory" ref="xfire.serviceFactory" />
		<property name="xfire" ref="xfire" />
		<property name="serviceBean" ref="hello" />
		<property name="serviceClass" value="com.Hello" />
	</bean>
	<bean id="hello1Service" class="org.codehaus.xfire.spring.remoting.XFireExporter">
		<property name="serviceFactory" ref="xfire.serviceFactory" />
		<property name="xfire" ref="xfire" />
		<property name="serviceBean" ref="hello1" />
		<property name="serviceClass" value="com.Hello" />
	</bean>


public class HelloImpl1 implements Hello {
    public String sayHello() {
        return "Hello My Girl1";
    }
}

public class HelloImpl implements Hello {
    public String sayHello() {
        return "Hello My Girl";
    }
}


用SOAP UI  去调,
/helloService 和/hello1Service

发现只会返回Hello My Girl1。。。

哥身经百战还第一次遇到这种。。。。真是。

还有一个需要的注意的就是实现接口的实现类的构造器必须是public 的,不然会杯具,xfire代理是构造不了这种SOAP信息的。。
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics