我创建了一个类
public class SearchProgressResponse
{
public SearchProgressResponse()
{
Progress = new List<SearchProgress>();
}
public List<SearchProgress> Progress { get; set; }
}
public class SearchProgress
{
public SearchProgress()
{
SearchError = new Error();
}
public string handle { get; set; }
public string code { get; set; }
public string message { get; set; }
public string name { get; set; }
public string state { get; set; }
public string image_data { get; set; }
public string challenge { get; set; }
public string image_type { get; set; }
public Error SearchError { get; set; }
}
public class Error
{
public string ErrorMessage { get; set; }
public string ErrorDetails { get; set; }
}
这是我的班级,它正在生成以下wsdl。
<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>
<GetSearchHandleResponse xmlns="http://jobboards.com/">
<GetSearchHandleResult>
<Progress>
<SearchProgress>
<handle>string</handle>
<code>string</code>
<message>string</message>
<name>string</name>
<state>string</state>
<image_data>string</image_data>
<challenge>string</challenge>
<image_type>string</image_type>
<SearchError xsi:nil="true" />
</SearchProgress>
<SearchProgress>
<handle>string</handle>
<code>string</code>
<message>string</message>
<name>string</name>
<state>string</state>
<image_data>string</image_data>
<challenge>string</challenge>
<image_type>string</image_type>
<SearchError xsi:nil="true" />
</SearchProgress>
</Progress>
</GetSearchHandleResult>
</GetSearchHandleResponse>
我的问题是为什么它生成搜索元素如下
<SearchError xsi:nil="true" />
我希望这个元素为
<SearchError>
<ErrorMessage>string</ErrorMessage>
<ErrorDetails>string</ErrorDetails>
</SearchError>
谁能告诉我在这里缺少什么?以及如何以上述格式生成? 提前谢谢。