org.apache.axis2.AxisFault:在webservice中传递对象数组时,Unknow类型无法序列化 [英] org.apache.axis2.AxisFault: Unknow type can not serialize while passing array of objects in webservice

查看:552
本文介绍了org.apache.axis2.AxisFault:在webservice中传递对象数组时,Unknow类型无法序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have created a webservice which takes a DTO as a parameter. And DTO contains an array of objects. I've generated WSDL and skeletons and clients. I am trying to invoke the webservice if I pass array of Strings say : Serializable[] array = new String[] { "a", "n" }; it works fine.

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

Now my requirement is to pass array of HashMaps I am not able to do so, even though HashMap implements Serializable.

 HashMap<String, String> hashMap1 = new HashMap<String, String>();
            HashMap<String, String> hashMap2 = new HashMap<String, String>();
            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。

I am using Axis2. 2.1.5, Tomcat 6, and Eclipse Helios.

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

Stack trace I am pasting here for reference.

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认为你的reqest不能得到,轴最近不支持它。谢谢和关心。

I am using Asix2 to devolpe a project, actually I do not have Axis2 experience very much,HashMap is complex object in Java, some base objects are suppoeted by Asix2, such as simple Array, so do not try to use complex objects of Java when you use Axis.I think your reqest can not get, for axis recently do not support it.Thanks and regards.

这篇关于org.apache.axis2.AxisFault:在webservice中传递对象数组时,Unknow类型无法序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆