2017-09-01 12 views
0

WCFサービスを作成しました。以下は私のコードです。WCFサービスのXMLシリアル化

[XmlArrayItem(ElementName="GetResult ")] 
public List<string> Array = new List<string>(); 

public List<string> Get() 
    { 
     this.Array.Add("Apple"); 
     this.Array.Add("Orange"); 
     this.Array.Add("Pears"); 
     return this.Array; 
    } 

私はこの

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header /> 
    <s:Body> 
    <GetResponse xmlns="http://tempuri.org/"> 
     <GetResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
     <GetResult >Apple</GetResult > 
     <GetResult >Orange</GetResult > 
     <GetResult >Pears</GetResult > 
     </GetResult> 
    </GetResponse> 

ようになり、XML応答を必要とするが、実際の結果は、私の所望の応答を取得する方法

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header /> 
    <s:Body> 
    <GetResponse xmlns="http://tempuri.org/"> 
     <GetResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
     <a:string>Apple</a:string> 
     <a:string>Orange</a:string> 
     <a:string>Pears</a:string> 
     </GetResult> 
    </GetResponse> 

です。

[XmlArrayItem(ElementName="")] 
public List<string> GetResult = new List<string>(); 

ハッピーコード:誰かが私

答えて

0

てみてください助けてください!

関連する問題