serialization

Python: How do you call a method when you only have the string name of the method?

This is for use in a JSON API. I don't want to have: if method_str == 'method_1': method_1() if method_str == 'method_2': method_2() For obvious reasons this is not optimal. How would I use map strings to methods like this in a reusable way (also note that I need to pass in arguments to the called functions). Here is an exam...

Convert XmlDocument to FileInfo

I have a web service which returns a string representing an Xml file. The string is properly formed xml. I need to create FileInfo object from the string so that I can deserialize it. I don't have the file path or even if i do thats of no use as it is a disconnected server. I can convert string to XmlDocument by - XmlDocument doc = n...

Receiving a NoSuchMethodException while trying to transfer a serialized object from Android App to a Servlet

I have a normal java app that sends the same object to the servlet with no problems, but when I attempt it in an android app using the same code it craps out on me at: outputToServlet.writeObject(myobject) Throwing the NoSuchMethodException I'm able to send a String object no problem via the Android app... I've seen the "don't use ...

Serializing a WPF Image

I'm trying to understand how image serialization works in WPF. I have the following class: [Serializable] public class TestClass : ISerializable { public TestClass() { } protected TestClass(SerializationInfo info, StreamingContext context) { SerializedImage = (byte[])info.GetValue("SerializedImage", typeof(byte[]))...

Delayed reference setting in Java

I am developping a CORBA like inter object protocol that would support object aggregate transmission. When objects of an aggregate are serialized, they may have references to objets serialized later. These are forward references. A simple example is a circular list. If each object has a reference to the previously serialized object, th...

Consuming SOAP with service with name space

I´m consuming a SOAP web service, that it has namespace, some similar to: <?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions targetNamespace="http://www.company.com/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:company="http://www.company.com/" xmlns:apachesoap="http://xml.apache.org/xml-soap...

Is there a way to mark a class field to only be de-serialized and not serialized?

It sounds strange but this is exactly what I want because I am using a data structure named "Project" which gets serialized to a save file. I would like to be able to de-serialize an older version of a save file with deprecated fields in tact, but then re-serialize it using only the currently used fields. The problem is that I want to ...

XML Serialization and a Class with Binary Property - How can I get this to work?

I have the following serialization method shown below. The problem is that I am attempting to pass a class to it that contains a property of type Binary. The serialization is failing because of this property type. Is there any way I can serialize a class with a property of type Binary? private string Serialize<TEntity>(TEntity insta...

How can I keep GWT from trying to include every serializable class when I use ArrayList

I have an RPC service in GWT that needs to return a List. The List can be filled with various types of objects, all of which are serializable and all of are referenced elsewhere in my service so they should be available to GWT RPC. However, unless I put on a generic type parameter (e.g. ArrayList<String>), GWT gives me the warning: R...

Serialization for document storage

I write a desktop application that can open / edit / save documents. Those documents are described by several objects of different types that store references to each other. Of course there is a Document class that that serves as the root of this data structure. The question is how to save this document model into a file. What I need:...

Storing large amounts of data in files. What is the most performant option?

Currently doing XML serialization however, it is very slow. Looking for a way to save/load information from file very quickly not really interested in how it looks on disc (if anything I want it to be obscured as I don't want manual editing). Thinking of binary format however I am not sure if it would be able to serialize properties whi...

Java: Serialization/ Deserialization to/from XML instead of binary

I have a complex set of data models that currently implement java.io.Serializable, and I have successfully serialized and deserialized them with ObjectOutputStream and ObjectInputStream. However, the result are binary files (as expected), and I was wondering if Java supports serialization and deserialization in the same manner to a non-...

How does WCF serialize the method call?

I am wondering how WCF serialize the method call, e.g. how the target class, method, method parameters are serialized, anybody has idea? ...

How to encode a Map<String,String> as Base64 string?

i like to encode a java map of strings as a single base 64 encoded string. The encoded string will be transmitted to a remote endpoint and maybe manipulated by a not nice person. So the worst thing that should happen are invaild key,value-tuples, but should not bring any other security risks aside. Example: Map<String,String> map = .....

Adding service reference (inside a Silverlight class library) of a WCF service that uses business objects from a referenced libarary creates a proxy without the service client.

Hi All, I have a typical setup. The solution contains a regular .NET class library for business objects, A WCF project, a silverlight project and supporting web-app project, and some silverlight class libraries. The classes in my business class library are all marked with the "[serializable]" attribute. The WCF service has a method that...

WCF - REST - Flatten a collection during serialization

Greetings I'm trying to convert a "collection of collections" into better looking xml. Basically, I want to lie to the service consumer and make it look like there's a real object. This is what WCF creates automatically <EntityPropertyCollection xmlns="http://schemas.datacontract.org/2004/07/CustomSerializer" xmlns:i="http://www.w3.or...

Strange SerializationException for Enum in AppDomain

I am getting a SerializationException for an enum when calling from one AppDomain into another: System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Dummy.MyEnum,Dummy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Sample code: public enum MyEnum { A = 0, B = 1, C ...

Deserialization not working on MemoryStream

//Serialize the Object MemoryStream ms = new MemoryStream(); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(ms , ObjectToSerialize); byte[] arrbyte = new byte[ms .Length]; ms.Read(arrbyte , 0, (int)ms .Length); ms.Close(); //Deserialize the Object Stream s = new MemoryStream(arrbyte); s.Position = 0; Object obj = form...

What is the purpose of Serialization in Java?

I have read quite a number of articles on Serialization and how it is so nice and great but none of the arguments were convincing enough. I am wondering if someone can really tell me what is it that we can really achieve by serializing a class? ...

PHP remove object reference before serialize, restore after.

I have some objects that I wish to cache on disk. I use serialize() in this process. The objects contain some references to other objects. I don't want those to be serialized as well (that is done in some other place) because it would give me duplicate instances of the same real-world object when unserializing. Is there a way to change ...