axis2故障笔记-1

错误代码片段:
        RPCServiceClient serviceClient = new RPCServiceClient();
        Options options = serviceClient.getOptions();
         //设定服务提供者的地址
        EndpointReference targetEPR =  new  EndpointReference( "http://localhost:8080/Hello"  );
        options.setTo(targetEPR);
         //设定所要调用的服务的操作
        QName opGetHello =  new  QName( "http://Hello"  ,  "sayHello"  );
        Class[] returnTypes =  new  Class [] { String. class  };
         //设定调用的方法的参数值
        Object[] opGetHelloArgs =  new  Object[] {  "UFO"  };
         //得到调用的结果
        Object[] response = serviceClient.invokeBlocking(opGetHello,opGetHelloArgs,returnTypes);
这句报错如下:
// The type org.apache.axiom.om.OMElement cannot be resolved. It is indirectly referenced from required .class files
经过调查,因为build path 下面我只引用了axis2-1.6.2.jar.但是axis2在这里依赖于axiom-api,所以我后来通过maven的repository搜索了axiom.我把最新版的依赖加入,如下:
               <dependency>
                       < groupId >  org.apache.axis2 </ groupId  >
                       < artifactId >  axis2 </  artifactId >
                       < version >  1.6.2 </  version >
                </ dependency >
                < dependency >
                       < groupId >  org.apache.ws.commons.axiom </ groupId  >
                       < artifactId >  axiom-api </ artifactId  >
                       < version >  1.2.13 </  version >
                </ dependency >
OK.这个依赖好像还依赖了很大一堆其他的jar.问题搞定.

你可能感兴趣的:(java,javaee,webservice,axis2)