java - Axis 2 客户端未收到 Axis 2 Web 服务抛出的异常

标签 java web-services apache-axis

调用 Axis 2 Web 服务的 Axis 2 客户端(wsdl2java 生成的代码)未收到服务抛出的 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>

最佳答案

此操作是唯一的一个。所以你不会因此而收到任何肥皂缺陷。如果你想抛出错误,你的操作必须是 in-out 操作。

关于java - Axis 2 客户端未收到 Axis 2 Web 服务抛出的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7586417/

相关文章:

c# - 在 Web 服务中从 SQL Server 检索多个字段?

java - ThreadLocal 和非线程安全 API

java - 调用 Web 服务时出现 org.xml.sax.SAXParseException 错误

java - 如何根据 ViewModel 中的内容设置切换按钮

java - jaxws-maven-plugin、maven-enunciate-plugin 示例?

java - 在 IBM Websphere 8 中使用 axis2 (Sales Force) 访问 Web 服务时出现异常

java - axis2中的服务之间进行通信?

java - 为 HR-XML PositionOpening WSDL 生成 Web 服务代理客户端

java - 错误 : 'ContentNegotiatingViewResolver' of Spring 3. 0.3 MVC Portlet+JSON

java - 如何在JAVA中插入图片到背景并保存?