serialization

Correct way to close a socket and ObjectOutputStream? [Java]

Hi all, I am writing a networked application in Java, to communicate between the Client and the Server I am using Serialized objects to represent data/commands and sending them through object output/input streams. I am having problems cleanly closing the Connections, I assume that I am missing something fundamental that I do not really...

Deserialize session object without type reference?

I have a POCO (plain old clr object) stored in session, and would like to be able to reference properties from that object from within another process (B). I don't want the stand-alone process (B) to require a reference to the dll in which the poco's class is defined. Is it possible to convert the saved object (in session) to something...

How do I tell if a class can be serialized?

I'm looping through the Session keys and adding entries and their values to a Hashtable, which I'm then serializing. The problem I'm having is there is an object on the Session that is not serializable, and it shouldn't be serialized anyway. I'm looking around, and plenty of built-in types don't implement the ISerializable attribute, s...

WCF Serialization with object inheritance?

I have two objects, one is in our enterprise level and another in in our service level. The service object is inheriting from the enterprise. Here is a quick example: [DataContract] public class EnterpriseObject{ [DataMember] int ID{get; set;} string InternalUse{get; set;} } [DataContract] public class ServiceObject: En...

.Net Binary Serialization - How to Limit the Object Graph?

Hi, I have an object that I'd like to serialize and distribute between processes as efficiently as possible. The object itself has a reference to another object like so: public class Foo { // Unique Identifier: public int Id; public Bar Bar; } public class Bar { // Unique Identifier: public int Id; } The thing i...

Deserializing from JSON into PHP, with casting?

Suppose I have a User class with 'name' and 'password' properties, and a 'save' method. When serializing an object of this class to JSON via json_encode, the method is properly skipped and I end up with something like {'name': 'testName', 'password': 'testPassword'}. However, when deserializing via json_decode, I end up with a StdClass...

web service can't serialize an interface

I have an interface like so: public interface IDocument : ISerializable { Boolean HasBeenUploaded { get; set; } void ISerializable.GetObjectData(SerializationInfo, StreamingContext) { } } There are three documents that inherit from this, all of which serialize just fine. But when creating a simple web service, that does nothin...

Best way to serialize a C structure to be deserialized by Java, etc.

Currently, I'm saving and loading some data in C/C++ structs to files by using fread()/fwrite(). This works just fine when working within this one C app (I can recompile whenever the structure changes to update the sizeof() arguments to fread()/fwrite()), but how can I load this file in other programs without knowing in advance the sizeo...

XML Serialization - Missing Namespace Prefix at client end

I have created a .NET web service that returns an object, say Class "getResponse". The WS returns the following response ... <getResponse xmlns="http://tempuri.org/getCustomer/wsdl/"&gt; <Result xmlns="http://tempuri.org/getCustomer/"&gt; <ResultCode>OK</ResultCode> <ErrorsList/> </Result> </getResponse> while th...

How can I perform a threadsafe point-in-time snapshot of a key-value map in Java?

In my application, I have a key-value map that serves as a central repository for storing data that is used to return to a defined state after a crash or restart (checkpointing). The application is multithreaded and several threads may put key-value pairs into that map. One thread is responsible for regularly creating a checkpoint, i. e...

static members and boost serialization

I'm using Boost.Serialization to archive the contents of a class. One of the member variables is a static std::vector. Archiving and restoring goes fine, but I was kind of hoping the library would save static members only once, it appears that, judging by the filesize, the static members are fully saved for each archived instance. This...

Serializing is not storing object data, only object references

I have a node tree built out of Node objects. They are more complex than the code I am showing but only have primitive or Serializable instance members. Assuming each Node can have up to 10 children the code looks a bit like so. public class Node implements Serializable{ private static final long serialVersionUID = -84892621809022...

Serialize .NET Array to XML as base 64?

I'm writing a custom .NET serializer in C# and want to read and write Array objects to XML using XmlReader and XmlWriter. I would like to base64-encode the Array. The arrays may be 1-, 2- or 3-dimensional and the elements are bool or numeric types. I'm completely stumped. XmlReader and XmlWriter have methods for reading/writing Byte[] ...

Binding application/json to POCO object in asp.net mvc, Serialization exception

I'm passing json back up from my view to my controller actions to perform operations. To convert the json being sent in, to a POCO I'm using this Action Filter: public class ObjectFilter : ActionFilterAttribute { public Type RootType { get; set; } public override void OnActionExecuting(ActionExecutingContext filterContext) { IList<Erro...

Disable serialization cache

Is there a way to disable caching of serialized object in Java? I have this scenario: I have an object which is Serializable, I am serializing it, deserializing it, values are OK. On the same object, I am changing some value, I am serializing it, deserializing it, values are NOT OK, values are same as the first initially loaded. See...

Constructor not found during deserialization?

Given the following example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Serialization.Formatters.Binary; using System.IO; namespace SerializationTest { [Serializable] class Foo : Dictionary<int, string> { } class Program { static void Main(...

Deserialize unknown type with protobuf-net

I have 2 networked apps that should send serialized protobuf-net messages to each other. I can serialize the objects and send them, however, I cannot figure out how to deserialize the received bytes. I tried to deserialize with this and it failed with a NullReferenceException. // Where "ms" is a memorystream containing the serialized /...

What is the correct syntax to represent subobjects in JSON?

I have a simple object that is deserialized from JSON into a server-side object. JSON: { name : 'ObjectName', host : 'http://localhost', ImagesPath : '/Images/' } On the server side, the above JSON code gets deserialized into this C# object via System.Web.Script.Serialization.JavaScriptSeriali...

C++ Serialization Performance

Hi, I'm building a distributed C++ application that needs to do lots of serialization and deserialization of data stored in std containers. Currently Boost.serialization is adopted. However, it performs terrible. Our B-tree also use Boost.serialization to store key-value pair data, however, if we change Boost.serialziation to memcpy, th...

Cannot Serialize/Deserialize ArrayList

I'm trying to serialize and deserialize an array list with a object inside: HairBirt param = new HairBirt(); param.setName("name"); param.setValue(2.3f); HairBirt param2 = new HairBirt(); param2.setName("name2"); param2.setValue(2.4f); ArrayList<HairBirt> list = new ArrayList<HairBirt>(); list.add(param); list.add(param2); ByteArra...