Axis 2 Client not receiving a thrown exception from an Axis 2 Webservice
An Axis 2 client (wsdl2java generated code) invoking an Axis 2 Webservice is not receiving a RuntimeException thrown from a Service. The invoked method is a void method.
The Axis 2 version I'm using for both client and server is 1.6.1.
When I run the following test it completes successfully and no Exception is received:
@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>
This operation is an in only one. So you won't receive any soap faults from that. If you want to throw faults your operation must be an in-out one.
精彩评论