WCF将属性添加到soap body

时间:2015-03-31 20:13:09

标签: c# xml web-services wcf

我需要为body元素添加一个属性。我怎么能这样做?

<soapenv:Body wsu:Id="body">

我正在使用XmlSerializerFormat。我的代码:

f[ServiceContract(Namespace = "http://TSUtoMFC")]
[XmlSerializerFormat]
public interface IService
{
    [XmlSerializerFormat]
    [OperationContract]
    ResponseType SampleTestSmev();

}

    [MessageContract]
    [XmlSerializerFormat]
    public class ResponseType
    {
        [MessageHeader]
        public SecurityType Security = new SecurityType();
        [MessageHeader]
        public smevheader header = new smevheader();
        [MessageBodyMember(Namespace = "http://smev.gosuslugi.ru/rev120315")]
        public MessageType Message = new MessageType();
        [MessageBodyMember(Namespace = "http://smev.gosuslugi.ru/rev120315")]
        public MessageDataType MessageData = new MessageDataType();

}

1 个答案:

答案 0 :(得分:0)

您可以使用IDispatchMessageInspector启用自定义修改入站和出站邮件。