我想删除显示给以下的nResult标记。我尝试通过MessageContract更改DataContract,IsWrapped = false,如链接Avoid "...Response" tag in wcf soap message中显示的那样,但不起作用。
<nResponse xmlns="https://example.com/">
<nResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<error>
<Code>1</Code>
<Message>User/Password mismatch</Message>
<MessageUser>User/Password mismatch</MessageUser>
</error>
</nResult>
<id>1234567890</id>
</nResponse>
[MessageContract(WrapperName = "nResponse")]
public class Response
{
[MessageBodyMember(Order = 2)]
public int id { get; set; }
[MessageBodyMember(Order = 1, Name = "nResult", Namespace = "https://example.com/")]
public Result result = new Result();
}
[DataContract(Namespace = "https://example.com/")]
public class Result
{
[DataMember(EmitDefaultValue = false)]
public string signonResult { get; set; }
[DataMember(EmitDefaultValue = false)]
public string controlVersion { get; set; }
[DataMember(EmitDefaultValue = false)]
public Nullable<int> recordCount { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<record> resultSetName = new List<record>();
[DataMember(EmitDefaultValue = false)]
public Error error = new Error();
}