命名空间配置不正确的错误。一般应该是服务端的程序包名改变后造成的。
下面的这个例子取自webservice大讲堂的,这个教程很好很详细。
Exception in thread "main" org.apache.axis2.AxisFault: namespace mismatch require http://complexTypeService found http://ws.apache.org/axis2
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:517)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:539)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)
at complexTypeService.ComplexTypeRPCClient.main(ComplexTypeRPCClient.java:32)
解决办法:
1、查看该service的命名空间,访问网址http://localhost:8080/axis2/services/ComplexTypeService?wsdl
查看"targetNamespace=http://complexTypeService" ,说明命名空间为http://complexTypeService,其实就是包的名字。
2、修改客户端程序中使用命名空间的代码,比如:opAddEntry = new QName("http://complexTypeService", "getArray");
再运行的话就没有问题了。