org.apache.axis2.AxisFault:在Webservice中传递对象数组时,Unknow类型无法序列化

我创建了一个以DTO作为参数的Web服务。 DTO包含一系列对象。 我已经生成了WSDL,骨架和客户端。 我试图调用webservice,如果我传递字符串数组说:Serializable [] array = new String [] {“a”,“n”}; 它工作正常。

现在我的要求是传递HashMaps数组我无法这样做,即使HashMap实现了Serializable。

HashMap hashMap1 = new HashMap(); HashMap hashMap2 = new HashMap(); hashMap1.put("key1", "value1"); hashMap2.put("key1", "value1"); Serializable[] maps = new HashMap[] { hashMap1, hashMap2 }; myDTO.setParams(maps); request.setDTO(myDTO); InvokeServiceResponse response = stub.serviceMethod(request); 

我正在使用Axis2。 2.1.5,Tomcat 6和Eclipse Helios。

堆栈跟踪我在这里粘贴参考。

 org.apache.axis2.AxisFault: Unknow type can not serialize at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83) at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84) at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499) at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199) 

我正在使用Asix2来开发一个项目,实际上我没有很多Axis2经验,HashMap是Java中的复杂对象,一些基础对象是由Asix2支持的,比如简单的Array,所以不要尝试使用Java的复杂对象时你使用Axis.I认为您的要求无法获得,因为轴最近不支持它。谢谢和问候。

在服务器日志中查找堆栈跟踪; 这是客户端错误。

此外,如果你谷歌“未知类型无法序列化”,你会发现许multithreading。