错误代码片断:
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.问题搞定.