Apache轴的Web服务

时间:2011-08-09 05:53:10

标签: java web-services apache axis2

我使用Eclipse和Apache轴(Using this link)创建了我的Web服务。当我使用Eclipse和Apchache tomcat在我的本地机器上测试它时,它工作正常 然后我使用eclipse生成的文件在另一台机器上部署了我的Web服务。我将在WebContent\WEB-INF\services\AutocompleteService下创建的文件夹复制到了Jboss的server\default\deploy\i2b2.war\WEB-INF\services\AutocompleteService
当我尝试访问我的服务时,它会给我以下异常。

SEVERE: org.apache.axis2.AxisFault: Required element null defined in the schema can not be found in the request".

这是我的小型网络服务(不包括商业逻辑)

public class AutocompleteService
{
  public OMElement getCodes(OMElement input)
  {
    String query = input.getText();
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("", "");
    OMElement codes = fac.createOMElement("codes", omNs);
    // some biz logic 

    while (SOME_CONDITION)
    {
          OMElement code = fac.createOMElement("code", null, codes);
          OMAttribute value = fac.createOMAttribute("value", null, tempStr);
          code.addAttribute(value);
     }

      return codes;
    }

}  

这是我的services.xml文件

service name="AutocompleteService" >
    <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" locked="false">com.service.AutocompleteService</parameter>
</service>

我错过了什么吗?

编辑:我正在使用
1)Jboss 4.2.2
2)Axisa 2-1.5.2
3)Tomcat 6

1 个答案:

答案 0 :(得分:0)

更改了我的services.xml文件并且工作正常。我真的很惊讶,因为提到的文件是由Eclipse生成的,但它仍然没有用 我将文件更新为

<service name="AutocompleteService" >
    <Description>
        Please Type your service description here
    </Description>
    <operation name="getCodes">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
    <parameter name="ServiceClass" locked="false">com.service.AutocompleteService</parameter>
</service>