0

我正在尝试在axis2中实现一个简单的示例。我创建了服务类和 xml,生成了 aar 并在服务目录中展开。我可以注意到我的服务和操作 sayHello,但是在测试 web 服务时,它说在我的类 HelloAxisService 中没有这样的方法 sayHello。

这是services.xml

<service name="HelloAxisService">

<description>Hello Axis service</description>

        <messageReceivers>
   <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                     class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>

    <parameter name="ServiceClass">com.my.axis.HelloAxisService</parameter>

</service>

这是我的课

package com.my.axis;

public class HelloAxisService {

    private String sayHello(String name){

        return "Hello"+ name;
    }
}

我的网址是http://localhost:8080/axis2/services/HelloAxisService/sayHello?name=dude

尽管该服务存在于以下服务列表中,但我在浏览器和使用 axiom 的客户端程序中都遇到了错误

Available services

HelloAxisService

Service EPR : http://localhost:8080/axis2/services/HelloAxisService
Service Description : No description available for this service

Service Status : Active
Available Operations
sayHello
4

1 回答 1

0

在代码处仔细观察一番后,发现了问题所在。它是privatesayHello 方法的访问修饰符。改变它来public为我做这件事。

于 2012-05-14T09:16:32.713 回答