DTOをパラメータとして受け取るwebserviceを作成しました。 DTOにはオブジェクトの配列が含まれています。 私はWSDLとスケルトンとクライアントを生成しました。 文字列の配列を渡すと、webserviceを呼び出そうとしています。 Serializable [] array = new String [] {"a"、 "n"};それはうまく動作します。org.apache.axis2.AxisFault:Unknow型は、Webサービス内のオブジェクトの配列を渡している間にシリアル化できません。
私の要件は、HashMapがSerializableを実装しているにもかかわらず、そうすることができないHashMapsの配列を渡すことです。
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が含まれます。
スタックトレースここでは参考として貼り付けています。
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)
サーバ側に行く前に失敗しています。メソッドを呼び出す前に、このスタックトレースをクライアント側から取得しています。メソッド・エントリーに1つのsysoutを追加したので、サーバー・メソッドが呼び出されたかどうかがわかります。この場合、HashMapsの配列を使用するときに呼び出されるのではなく、Stringの配列の場合はgetttingが呼び出されます。私はフレーズとグーグルグーグルではなく、良いrelavent検索。 –