2014-06-12 48 views
-1

抛出异常,我正在学习如何编写使用JDK7,AXIS 2.的Http://..../mywebservice WSDL使用Axis2

在Java的web服务我复制一个非常简单的HelloWorld示例。

package example; 

      import javax.jws.WebMethod; 
      import javax.jws.WebService; 
      import javax.xml.ws.Endpoint; 


      @WebService() 
      public class HelloWorld implements IHelloWorld { 
       @WebMethod 
       public String sayHelloWorldFrom(String from) { 
       String result = "Hello, world, from " + from; 
       System.out.println(result); 
       return result; 
       } 

       public static void main(String[] argv) { 
        Object implementor = new HelloWorld(); 
        String address = "http://localhost:9001/HelloWorld"; 
        Endpoint.publish(address, implementor); 
       } 
      } 

我的服务,XML看起来像:

  <serviceGroup> 
       <service name="HelloWorld" targetNamespace="http://example"> 
        <Description>Hi</Description> 
        <parameter name="ServiceClass" locked="false">example.HelloWorld</parameter> 
        <operation name="*"> 
         <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> 
        </operation> 
       </service> 
      </serviceGroup> 

当我尝试看看使用

http://localhost:9001/services/HelloWorldService?wsdl 

我看到WSDL: enter image description here 问题是什么?

- 谢谢

回答

0

PS:你的错误信息截图太小了。但我可以用IndexOutOfBoundException解密某些东西。我认为当我以错误的方式调用我的Web服务时(但不确定)。

无论如何,因为你使用的Axis2,你能不能简单地看

http://localhost:9001/axis2/services/listServices 

,看看是否列在您的服务? 我认为你的服务是HelloWorld,而不是HelloWorldService。

+0

我发现我正在开发Axis2应用程序不正确。我应该开发一个.aar应用程序并将其部署到Axis2.war文件中的services目录。 Axis2.war文件可以在[link](http://axis.apache.org/axis2/java/core/download.cgi)找到。下载二进制文件或WAR文件。 –

+0

btw:您可以将aar或jar部署到服务目录中... – Oli

相关问题