【发布时间】:2016-08-17 14:53:44
【问题描述】:
我有两门课
public class Person
{
public String ForeName {get;set;}
//...
}
public class Customer : Person
{
public String LastName{get;set;}
//...
}
如果我现在通过 SOAP 服务返回 Customer,它只会在操作列表的 SOAP 信封示例中显示 LastName。
网络方法:
[WebMethod(MessageName = "getCustomer")]
public Customer GetCustomer()
{
return new Customer();
}
响应示例:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getCustomerResponse xmlns="http://tempuri.org/">
<getCustomerResult>
<LastName>string</LastName>
</getCustomerResult>
</getCustomerResponse>
</soap:Body>
</soap:Envelope>
注意: 该代码工作正常,WSDL 是正确的。我只对正确的 SOAP 信封感兴趣。
问题:
如何标记Customer 以便它也显示Person 的属性?
我在框架中使用 C# ASP.Net 是 3.5
【问题讨论】:
-
不,答案下方的评论再次说明了我的问题:“它似乎生成了正确的代码,它只是没有显示在示例中。”
标签: c# asp.net web-services soap