Axis 2 Client未从Axis 2 Web服务接收抛出的异常

时间:2011-09-28 16:27:03

标签: java web-services axis2

调用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>

1 个答案:

答案 0 :(得分:2)

此操作只有一个。因此,您不会从中收到任何肥皂故障。如果你想抛出错误,你的操作必须是一个完整的操作。