调用Axis 2 Webservice的Axis 2客户端(wsdl2java生成的代码)未收到从Service抛出的RuntimeException。调用的方法是 void方法。
我用于客户端和服务器的Axis 2版本是1.6.1。
当我运行以下测试时,它成功完成且未收到任何异常:
@Test
public void testMyService() throws RemoteException {
String target = "http://localhost:8080/services/MyService";
MyServiceStub myServiceStub = new MyServiceStub(target);
myServiceStub.doSomething();
}
MyService.java:
package com.afirme.webservice.service;
@Service
public class MyService {
public void doSomething() {
throw new IllegalArgumentException("Just testing!");
}
}
的services.xml:
<serviceGroup>
<service name="MyService">
<description>
My Service
</description>
<messageReceivers>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier</parameter>
<parameter name="SpringBeanName">myService</parameter>
</service>
</serviceGroup>
答案 0 :(得分:2)
此操作只有一个。因此,您不会从中收到任何肥皂故障。如果你想抛出错误,你的操作必须是一个完整的操作。