wcf-serialization

Remove “d1p1” namespace prefix in DataContractSerializer XML output

一曲冷凌霜 提交于 2019-12-21 07:34:32
问题 I'm using DatacontractSerializer to serialize my domainModel into a xml file. I'm getting output like below. <z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:d1p1="DCSerialization_IGITApproach" i:type="d1p1:X" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"> <d1p1:Name z:Id="2">Ankit</d1p1:Name> <d1p1:PointsDictionary xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" z:Id="3" z:Size="1"> <d2p1:KeyValueOfstringPointsArrayq9VX7VJJ>

WCF, Streaming, Message Contract Error: Error in deserializing body of request message

安稳与你 提交于 2019-12-19 09:38:51
问题 I have developed a bit of a complicated WCF Service method. I would like to use the Streaming transfer mode, and because I have more than one parameter, I have defined a MessageContract with a body and a header. [MessageContract] public class ReportAudioMessage { [MessageHeader] public int ReportId; [MessageHeader] public string FileName; [MessageHeader] public int FileLengthInBytes; [MessageHeader] public int LengthInSeconds; [MessageBodyMember] public Stream ReportAudio; } Notice the stream

Why is a message in WCF seemingly always in SOAP format?

别说谁变了你拦得住时间么 提交于 2019-12-11 09:57:32
问题 I have implemented a message inspector in WCF by implementing IDispatchMessageInspector . Putting a break point on this method... public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { // Impementation } ... I can look at the request object to see what is inside. Clearly I dont understand WCF enough because whatever endpoint binding I use (basichttp, nettcp and netpipe) the message inside is always represented in SOAP format e.g. <s

WCF Serialization Exception - NetDataContractSerializer

 ̄綄美尐妖づ 提交于 2019-12-10 14:43:56
问题 I am getting an error while trying to send an collection of data over to our service. If however I add only a single item to the collection then it works fines. As soon as I add more then one item I get the following error The use of type 'SmartTrade.Shared.Common.PaymentTerm' as a get-only collection is not supported with NetDataContractSerializer. Consider marking the type with the CollectionDataContractAttribute attribute or the SerializableAttribute attribute or adding a setter to the

Newtonsoft.Json causing serialization to happen twice causing duplicate definition in the Reference.cs

可紊 提交于 2019-12-06 19:03:07
问题 I have a project Common that has a service reference. After adding a reference to Newtonsoft.json(Version 6.0.2 to the same project(Common) which has service reference, and a Serializable class ChatLine [Serializable] public class ChatLine { [JsonProperty("L")] public string LineId { get; set; } [JsonProperty("CT")] public DateTime ConversationTimeInUtc { get; set; } [JsonProperty("S")] public string SenderId { get; set; } [JsonProperty("R")] public IEnumerable<string> Recipients { get; set;

Newtonsoft.Json causing serialization to happen twice causing duplicate definition in the Reference.cs

为君一笑 提交于 2019-12-04 22:59:55
I have a project Common that has a service reference. After adding a reference to Newtonsoft.json(Version 6.0.2 to the same project(Common) which has service reference, and a Serializable class ChatLine [Serializable] public class ChatLine { [JsonProperty("L")] public string LineId { get; set; } [JsonProperty("CT")] public DateTime ConversationTimeInUtc { get; set; } [JsonProperty("S")] public string SenderId { get; set; } [JsonProperty("R")] public IEnumerable<string> Recipients { get; set; } [JsonProperty("CM")] public string ConversationMessage { get; set; } } I updated the service

Remove “d1p1” namespace prefix in DataContractSerializer XML output

会有一股神秘感。 提交于 2019-12-04 01:23:30
I'm using DatacontractSerializer to serialize my domainModel into a xml file. I'm getting output like below. <z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:d1p1="DCSerialization_IGITApproach" i:type="d1p1:X" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"> <d1p1:Name z:Id="2">Ankit</d1p1:Name> <d1p1:PointsDictionary xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" z:Id="3" z:Size="1"> <d2p1:KeyValueOfstringPointsArrayq9VX7VJJ> <d2p1:Key z:Id="4">key1</d2p1:Key> <d2p1:Value xmlns:d4p1="http://schemas.datacontract.org/2004/07

How to trace WCF serialization issues / exceptions

末鹿安然 提交于 2019-12-01 03:44:18
I occasionally run into the problem that an application exception is thrown during the WCF-serialization (after returning a DataContract from my OperationContract). The only (and less meaningfull) message I get is System.ServiceModel.CommunicationException : The underlying connection was closed: The connection was closed unexpectedly. without any insight to the inner exception, which makes it really hard to find out what caused the error during serialization. Does someone know a good way how you can trace, log and debug these exceptions? Or even better can I catch the exception, handle them

How to trace WCF serialization issues / exceptions

你说的曾经没有我的故事 提交于 2019-12-01 00:25:56
问题 I occasionally run into the problem that an application exception is thrown during the WCF-serialization (after returning a DataContract from my OperationContract). The only (and less meaningfull) message I get is System.ServiceModel.CommunicationException : The underlying connection was closed: The connection was closed unexpectedly. without any insight to the inner exception, which makes it really hard to find out what caused the error during serialization. Does someone know a good way how