后来才发现原来是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信息的。。