2016-06-22 38 views
0

我想使用soap请求发送对象列表。我可以传递一个对象到肥皂请求中,就像我会传递一个字符串或一个int?将对象传递给soap请求

public class Customer 
    { 
    public string Name {set;get;} 

    } 

string field1 ="Hello"; 
List<Customer> p = new List<Customer>(); 
p.Add(new details() { Name ="XXXX" }); 
p.Add(new details() { Name ="YYYY" }); 

    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> 
     <soap12:Body> 
     <Sample xmlns="http://tempuri.org/"> 
      <Stringfield1>field1</Stringfield1> 
      <ObjectField>p</ObjectField> //Passing the List of CUstomer 
     </Sample > 
     </soap12:Body> 
    </soap12:Envelope> 
+0

通常情况下,您有一个代理服务器负责为您提供Soapy详细信息,但是如果您要自己创建XML,则必须知道服务如何预期您的客户列表被格式化。 – Crowcoder

回答

0

是的,作为一个WCF函数的参数的任何对象将要进行的服务合同的WSDL的一部分,并应提供客户参考的服务上。有许多属性可用于控制对象及其成员的某些行为,以及如何对其进行序列化和反序列化。