2011-07-05 1 views
1

私はAxis2/Webservice初心者です。単純なPOJOをWebサービス(以下のコード)に変換しようとしています。クラスPieceInfoには@XmlRootElementと注釈が付けられています。クラス(ObjectFactory)は、メソッド(以下のコード)でPieceInfoを返します。 PieceInfoの作業を使用するメソッドは、java.util.List is not known to this contextなどのJAXB例外をスローするパラメータとしてList<PieceInfo>またはPieceInfo[]を使用するメソッドです。リストや配列はうまくいくはずだと思った。私は間違って何をしていますか?Axis2のパラメータとしての配列POJO Webservices?

@WebService (name="KMPService",targetNamespace="http://www.ict.ie.tss/") 
@MTOM 
public interface KMPServiceInterface { 

@WebMethod 
void updateRootInfo(String username, String password, PieceInfo info); 

@WebMethod 
PieceInfo getRootInfo(String username, String password); 

@WebMethod 
void put(String username, String password, List<PieceInfo> infoList); 

@WebMethod 
PieceInfo[] get(String username, String password, 
    PieceInfo[] infoList); 

@WebMethod 
void deleteEntries(String username, String password, 
    PieceInfo[] infoList); 

} 

ObjectFacotry:代わりのjava.util.Listの

@XmlRegistry 
public class ObjectFactory { 

public PieceInfo createPieceInfo(){ 
    return new PieceInfo(); 
} 

} 

答えて

1

答えは:Axis2を使用しないでください。 cxfを使うと、すぐに全てのリストと配列が使えます。

0

使用アレイ。

Webサービスは、.Net Webサービスクライアントのように、java.util.Listオブジェクトを構築する方法はわかりませんが、Webサービスを構築する方法を理解できるはずです。 PieceInfoオブジェクトの配列。

「このコンテキストに知られていない」問題が削除されたらうれしいことです。また、Axisフレームワークが作成できるように、PieceInfoに引数のコンストラクタがゼロであることを確認してください。

+0

アレイも機能しません。私が配列を使うと、私は '[... model.PieceInfo;この文脈では知られていない。私がただ一つの 'PieceInfo'オブジェクトを使っていれば、うまく動作します。ちょうど彼らの配列やそれらのリストではありません。 – Carsten

関連する問題