Handling custom datacontract serialization at WCF endpoint breakpoint

I want to use XML attributes instead of elements in xmlrequest and xmlresponse, I have implemented IXmlSerializable like this:

public partial class Id : IXmlSerializable
{

    /// <remarks/>
    [XmlAttribute]
    public string lmsId;

    /// <remarks/>

    [XmlAttribute]
    public string unitId;

    /// <remarks/>

    [XmlAttribute]
    public string lmsPresId;

    /// <remarks/>

    [XmlAttribute]
    public string callId;

    public System.Xml.Schema.XmlSchema GetSchema()
    {
        return null;
    }

    public void ReadXml(System.Xml.XmlReader reader)
    {
        //implement if remote callers are going to pass your object in
    }

    public void WriteXml(System.Xml.XmlWriter writer)
    {
        writer.WriteAttributeString("lmsId", lmsId.ToString());
        writer.WriteAttributeString("unitId", unitId.ToString());
        writer.WriteAttributeString("lmsPresId", lmsPresId.ToString());
        writer.WriteAttributeString("callId", callId.ToString());
    }
}

      

But my service help shows request and response as unknown


I have tried even XmlSerializerFormat

[System.ServiceModel.MessageContract]
public partial class Id
{

    /// <remarks/>
    [XmlAttribute, MessageBodyMember]
    public string lmsId;

    /// <remarks/>

    [XmlAttribute, MessageBodyMember]
    public string unitId;

    /// <remarks/>

    [XmlAttribute, MessageBodyMember]
    public string lmsPresId;

    /// <remarks/>

    [XmlAttribute, MessageBodyMember]
    public string callId;
}

      

then i get everything in xml as xmlElements instead of XmlAttributes. But I am getting all data as elements instead of Xmlattributes.

+3
ixmlserializable wcf datacontractserializer xmlserializer


source to share


No one has answered this question yet

Check out similar questions:

394
REST / SOAP Endpoints for WCF Service
25
WCF Datacontract, some fields are not deserialized
3
IsReference DataContract Property with WCF and DataContractSerializer
3
WCF DataContract Serializing Bidirectional Objects or Circular Dependencies
1
WCF DataContract requires serialization?
1
IXmlSerializable list item
0
WCF service supports both data serializer and XML serializer
0
XmlIncludeAttribue Effects When Used In WCF DataContract
0
using DataContractSerializer to store data in Isolatedstorage
0
Serializing DataContract to REST WCF



All Articles
Loading...
X
Show
Funny
Dev
Pics