0
調用Axis 2 Webservice的Axis 2客戶端(wsdl2java生成的代碼)沒有收到服務拋出的RuntimeException。被調用的方法是無效方法。Axis 2客戶端未收到來自Axis 2 Web服務的拋出異常
我用於客戶端和服務器的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>
請參閱[這個問題](http://stackoverflow.com/questions/3954632/create-custom-exceptions-in-axis2)。你需要拋出一個'AxisFault'。 – ig0774
這沒有奏效。 –
那麼你真的嘗試了什麼? – ig0774