2011-12-23 1 views
1

軸2を使用してWebサービスを実装しています。 私が直面する問題は、メソッドの1つで複雑な構造体を返すことです。ここ は、私が何をしたいです:軸2の複合型 - マップ

を戻り値の型として - ペアはSOAPUI

とリターンでそれをテスト

public class Pair { 

     private String key; 
     private String value; 
........... 
} 

イム常にここに空 ですMap<String, Pair[]>は、単純な応答であります私はpairResponseがすべきは、結果が含まれてい

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Body> 
     <ns:getSNSTrendsResponse xmlns:ns="http://soap.sso.vwdcrm.app.mailprofiler.com"> 
     <ns:return xsi:type="ax211:SNSData" xmlns:ax212="http://util.java/xsd" xmlns:ax211="http://objects.soap.sso.vwdcrm.app.mailprofiler.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
      <ax211:errorCode>1</ax211:errorCode> 
      <ax211:errorMessage xsi:nil="true"/> 
      <ax211:pairsResponse xsi:type="axis2ns2:anyType"> 
       <empty xmlns="http://www.w3.org/2001/XMLSchema">false</empty> 
      </ax211:pairsResponse> 
      <ax211:response xsi:nil="true"/> 
     </ns:return> 
     </ns:getSNSTrendsResponse> 
    </soapenv:Body> 
</soapenv:Envelope 

...

01を得ました

答えて

2

コンパイル時にJavaジェネリック(たとえば配列型とは異なります)が消去されるため、Map<String, Pair[]>の軸はMapと同じです。

Java SOAPでキーとオブジェクトのマッピングを表す通常の方法は、オブジェクトにキーが含まれている配列を使用することです。

あなたのマップでは、Pair.key値でインデックスされている場合は、Pair[]を使用すると効果があります。

関連する問題