• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
黄洪波写点东西的地方
博客园    首页    新随笔    联系   管理    订阅  订阅
The ServiceClass object does not implement the required method in the following form: OMElement sayHello(OMElement e)

今天遇到一件诡异的事情,打好的同一个aar包,丢到测试环境tomcat,使用soapui测试,正常反馈结果。

丢到本地tomcat,使用soapui测试,始终报以下错误。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>The ServiceClass object does not implement the required method in the following form: OMElement sayHello(OMElement e)</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

查找该错误,所有的解决方案均指向需要在aar工程中配置service.xml文件。

但是,我是同一个包啊,测试环境不需要service.xml就能正确运行,没道理放到本地环境中不行啊。

于是再将测试环境中的axis2.xml替换掉本地的axis2.xml,发现serverlist中一个服务都没有了。

后来猜测是不是版本的原因,查看测试环境中的版本,axis2 1.6.0,本地版本axis2 1.7.3.

于是下载1.6.0至本地环境,无需配置service.xml即能正确运行soapui进行测试。

这个太坑了,新版本竟然不支持不配置service的方式。


 修改与2017/04/19

抱歉,前面的解释没经过仔细的试验,在经过试验之后得出以下结论

生成aar包的Service Archive plugin的版本需要不高于服务器上运行时的axis2的版本才能正确的运行服务。

 建议:服务器运行时版本与生成服务包的版本保持一致。

如果不确定服务器运行时的axis2版本,可以通过webapps/axis2/WEB-INF/services查看,或者使用http://server:port/axis2/services/Version?wsdl获取版本号。


修改于2017/04/20

上述问题经过再次在java代码中使用RPCClient的方式调用。

分别使用

a.先打jar包,再改后缀为aar,最后手工编辑services.xml的方式生成aar包(手工生成AXIS2的aar文件)

b.直接使用Serveice Archive plugin插件生成aar包的方式

进行了测试。

测试结果如下。

a.

b.

。

通过对比发现使用,

插件1.6.2生成的service.xml内容如下:

<service name="HelloServer" >
    <description>
        Please Type your service description here
    </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="ServiceClass">com.hongbo.server.HelloServer</parameter>
</service>

插件1.7.4生成的service.xml内容如下:

<service name="HelloServer" >
    <description>
        Please Type your service description here
    </description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/ns/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass">com.hongbo.server.HelloServer</parameter>
</service>

 关于MEP的解释:

Apache Axis2用户指引-介绍服务

Web 服务与 Axis2 体系结构

posted on 2016-12-02 16:32  红无酒伤  阅读(2392)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3