serialization

Passing Python List to WCF Service

老子叫甜甜 提交于 2019-12-23 09:37:04
问题 I am trying to pass a list (or array, collection) of strings from python to a WCF service endpoint The WCF interface: [OperationContract] string[] TestList(IEnumerable<string> vals); Binding in Web.config: <endpoint address="http://localhost:13952/Service/Endpoint.svc" binding="basicHttpBinding" contract="Service.IEndpoint"> Python code calling the service: from suds.client import Client url = 'http://localhost:13952/Service/Endpoint.svc?wsdl' client = Client(url) result = client.service

how to serialize hashtable in c#

爷,独闯天下 提交于 2019-12-23 09:36:43
问题 I have implemented session state mode sqlserver and when i run my application i am facing XML serialization error of hash table . and my class looks like: [Serializable] public class ProjectSetup{ private System.Collections.Hashtable _ConfigTable; //and other properties here public System.Collections.Hashtable ConfigTable { get { return _ConfigTable; } } } Now i want to know how to serialize the hastable or if there is another alternative please let me know. and exactly error is: "Cannot

Json.Net Deserialization Constructor vs. Property Rules

孤人 提交于 2019-12-23 09:34:20
问题 I was troubleshooting a (de)serialization issue with the following class using Json.Net: public class CoinsWithdrawn { public DateTimeOffset WithdrawlDate { get; private set; } public Dictionary<CoinType, int> NumberOfCoinsByType { get; private set; } public CoinsWithdrawn(DateTimeOffset withdrawDate, Dictionary<CoinType, int> numberOfCoinsByType) { WithdrawlDate = withdrawDate; NumberOfCoinsByType = numberOfCoinsByType; } } The problem is that the constructor argument "withdrawDate" is named

how to serialize for android.location class?

别等时光非礼了梦想. 提交于 2019-12-23 09:34:13
问题 I'm trying to serialize my location class (using android.location class) but, it gives me an error! 11-21 21:25:37.337: W/System.err(3152): java.io.NotSerializableException: android.location So, I tried to extend the android.location.Location class. private class NewLocation extends Location implements Serializable { private String Provider; private double Latitude, Longitude, Altitude; private float bear; public NewLocation(Location l) { super(l); Provider = l.getProvider(); Latitude = l

JavaScriptSerializer deserialize object “collection” as property in object failing

安稳与你 提交于 2019-12-23 09:32:18
问题 I have a js object structured like: object.property1 = "some string"; object.property2 = "some string"; object.property3.property1 = "some string"; object.property3.property2 = "some string"; object.property3.property2 = "some string"; i'm using JSON.stringify(object) to pass this with ajax request. When i try to deserialize this using JavaScriptSerializer.Deserialize as a Dictionary i get the following error: No parameterless constructor defined for type of 'System.String'. This exact same

Asp.net: Can a delegate (“Action”) be serialized into control state?

安稳与你 提交于 2019-12-23 09:31:37
问题 I am implementing a user control that has a method that takes an Action delegate as a parm. Attempting to store the delegate in Control State yields a serialization error. Is it even possible to serialize a delegate into Control State? BP 回答1: Not easily - and it could open the door for potential problems. It is theoretically possible to use reflection to determine which method of an object the delegate is invoking, and write a custom serialization process for it. Upon deserialization you

How can I deseralize json object in java pojo class?

别说谁变了你拦得住时间么 提交于 2019-12-23 09:17:39
问题 I have a simple JSON statement which type is very per need. like this { actor:{name:"kumar",mbox:"kumar@gmail.com"} verb :"completed" } or { actor:{name:["kumar","manish"],mbox:["kumar@gmail.com","manish@gmail.com"]} verb :{ "id" : "http://adlnet.gov/expapi/verbs/completed", "display" : { "en-US" : "completed" } } I am using using POJO class to map this json string and pojo class code is given bleow @JsonProperty("actor") Actor actor; @JsonProperty("verb") Verb objVerb; @JsonProperty("verb")

Why we need not to declare a serialVersionUID(or equivalent) in C#?

大憨熊 提交于 2019-12-23 09:16:50
问题 In Java it is strongly recommended that all serializable classes explicitly declare serialVersionUID since the default serialVersionUID computation is highly sensitive to class details and compiler implementation is unreliable. What's so special about serialization in C#? 回答1: In .Net Serialization is less cranky than in Java. By default it supports new fields just defaulting them, and it just ignore any data it doesn't expect. You can still implement the same kind of version control by

TypeNameHandling in Newtonsoft requires $type to be the first property? [duplicate]

社会主义新天地 提交于 2019-12-23 09:11:20
问题 This question already has an answer here : Newtonsoft JSON.net deserialization error where fields in JSON change order (1 answer) Closed 3 years ago . I have the following method in my web api public void Put(string id, [FromBody]IContent value) { //Do stuff } I'm using backbone js to send the following JSON to the server using fiddler the value is null: { "id": "articles/1", "heading": "Bar", "$type": "BrickPile.Samples.Models.Article, BrickPile.Samples" } but if I add the $type property

Deserialize <ArrayOf> in XML to List<>

眉间皱痕 提交于 2019-12-23 09:05:14
问题 I have trouble deserializing the result from my WCF webservice. The method returns a List<RecipeEntity> , which is serialized to XML as shown below. When I try to deserialize I just get an exception, shown below. It seems I cannot deserialize <ArrayOfRecipe> to List<RecipeEntity> . Note that RecipeEntity is mapped by contract name to Recipe . After searching I see many propose XmlArray and XmlElement attributes, but as far as I can tell they do not apply here on the GetRecipes() method. I