Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 888443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:23:55+00:00 2026-05-15T13:23:55+00:00

im trying to serialize some object as xml and then read it back the

  • 0

im trying to serialize some object as xml and then read it back
the code is:
IncomingTradeMessage inherits BaseMessage and contains InternalRequestInfo which in turn contains InternalTradeTransInfo. this is the code:

std::ostringstream oStringStream;
boost::archive::xml_oarchive xmlArchive(oStringStream);

xmlArchive.register_type(static_cast<BaseMessage *>(NULL));
xmlArchive.register_type(static_cast<IncomingTradeMessage *>(NULL));
xmlArchive.register_type(static_cast<InternalRequestInfo *>(NULL));
xmlArchive.register_type(static_cast<InternalTradeTransInfo *>(NULL));


const BaseMessage* myMessage =message;

xmlArchive << make_nvp("Message", myMessage);

std::string strData = oStringStream.str();

std::istringstream iStringStream(strData,istringstream::in);
std::string nothing;

//iStringStream. >> nothing;

BaseMessage* x = new IncomingTradeMessage();

boost::archive::xml_iarchive xmlIncomingArchive(iStringStream);

xmlIncomingArchive >> make_nvp("Message",*x);

when trying to deserialize the first member of the base i get:
Unhandled exception at 0x7c812aeb in mtsrv.exe: Microsoft C++ exception: boost::archive::archive_exception at memory location 0x0eb6df58..

at:

  kernel32.dll!7c812aeb()  
  [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] 
  kernel32.dll!7c812aeb()  
  xxxServerAPI.dll!_CxxThrowException(void * pExceptionObject=0x0eb6df58, const _s__ThrowInfo * pThrowInfo=0x05481c68)  Line 161 C++
> xxxServerAPI.dll!boost::serialization::throw_exception<boost::archive::archive_exception>(const boost::archive::archive_exception & e={...})  Line 37 C++
  xxxServerAPI.dll!boost::archive::basic_xml_iarchive<boost::archive::xml_iarchive>::load_end(const char * name=0x05458c20)  Line 53 + 0x35 bytes C++
  xxxServerAPI.dll!boost::archive::basic_xml_iarchive<boost::archive::xml_iarchive>::load_override<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >(const boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > & t={...}, int __formal=0)  Line 88 C++
  xxxServerAPI.dll!boost::archive::xml_iarchive_impl<boost::archive::xml_iarchive>::load_override<boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > const >(const boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > & t={...}, int __formal=0)  Line 81 C++
  xxxServerAPI.dll!boost::archive::detail::interface_iarchive<boost::archive::xml_iarchive>::operator>><boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > const >(const boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > & t={...})  Line 62 C++
  xxxServerAPI.dll!boost::archive::detail::interface_iarchive<boost::archive::xml_iarchive>::operator&<boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > const >(const boost::serialization::nvp<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > & t={...})  Line 69 C++
  xxxServerAPI.dll!x::Native::xServerApi::Messages::BaseMessage::serialize<boost::archive::xml_iarchive>(boost::archive::xml_iarchive & ar={...}, const unsigned int version=0)  Line 30 C++
  xxxServerAPI.dll!boost::serialization::access::serialize<boost::archive::xml_iarchive,x::Native::xServerApi::Messages::BaseMessage>(boost::archive::xml_iarchive & ar={...}, x::Native::xServerApi::Messages::BaseMessage & t={...}, const unsigned int file_version=0)  Line 119 C++
  xxxServerAPI.dll!boost::serialization::serialize<boost::archive::xml_iarchive,x::Native::xServerApi::Messages::BaseMessage>(boost::archive::xml_iarchive & ar={...}, x::Native::xServerApi::Messages::BaseMessage & t={...}, const unsigned int file_version=0)  Line 74 + 0x11 bytes C++
  xxxServerAPI.dll!boost::serialization::serialize_adl<boost::archive::xml_iarchive,x::Native::xServerApi::Messages::BaseMessage>(boost::archive::xml_iarchive & ar={...}, x::Native::xServerApi::Messages::BaseMessage & t={...}, const unsigned int file_version=0)  Line 133 + 0x18 bytes C++
  xxxServerAPI.dll!boost::archive::detail::iserializer<boost::archive::xml_iarchive,x::Native::xServerApi::Messages::BaseMessage>::load_object_data(boost::archive::detail::basic_iarchive & ar={...}, void * x=0x054e1490, const unsigned int file_version=0)  Line 186 + 0x1a bytes C++
  xxxServerAPI.dll!boost::archive::detail::basic_iarchive_impl::load_object(boost::archive::detail::basic_iarchive & ar={...}, void * t=0x054e1490, const boost::archive::detail::basic_iserializer & bis={...})  Line 400 C++
  xxxServerAPI.dll!boost::archive::detail::basic_iarchive::load_object(void * t=0x054e1490, const boost::archive::detail::basic_iserializer & bis={...})  Line 548 C++
  xxxServerAPI.dll!boost::archive::detail::load_non_pointer_type<boost::archive::xml_iarchive>::load_standard::invoke<x::Native::xServerApi::Messages::BaseMessage>(boost::archive::xml_iarchive & ar={...}, const x::Native::xServerApi::Messages::BaseMessage & t={...})  Line 387 C++
  xxxServerAPI.dll!boost::archive::detail::load_non_pointer_type<boost::archive::xml_iarchive>::invoke<x::Native::xServerApi::Messages::BaseMessage>(boost::archive::xml_iarchive & ar={...}, x::Native::xServerApi::Messages::BaseMessage & t={...})  Line 433 + 0xd bytes C++
  xxxServerAPI.dll!boost::archive::load<boost::archive::xml_iarchive,x::Native::xServerApi::Messages::BaseMessage>(boost::archive::xml_iarchive & ar={...}, x::Native::xServerApi::Messages::BaseMessage & t={...})  Line 580 + 0xd bytes C++
  xxxServerAPI.dll!boost::archive::detail::common_iarchive<boost::archive::xml_iarchive>::load_override<x::Native::xServerApi::Messages::BaseMessage>(x::Native::xServerApi::Messages::BaseMessage & t={...}, int __formal=0)  Line 68 + 0x15 bytes C++
  xxxServerAPI.dll!boost::archive::basic_xml_iarchive<boost::archive::xml_iarchive>::load_override<x::Native::xServerApi::Messages::BaseMessage>(const boost::serialization::nvp<x::Native::xServerApi::Messages::BaseMessage> & t={...}, int __formal=0)  Line 87 C++
  xxxServerAPI.dll!boost::archive::xml_iarchive_impl<boost::archive::xml_iarchive>::load_override<boost::serialization::nvp<x::Native::xServerApi::Messages::BaseMessage> const >(const boost::serialization::nvp<x::Native::xServerApi::Messages::BaseMessage> & t={...}, int __formal=0)  Line 81 C++
  xxxServerAPI.dll!boost::archive::detail::interface_iarchive<boost::archive::xml_iarchive>::operator>><boost::serialization::nvp<x::Native::xServerApi::Messages::BaseMessage> const >(const boost::serialization::nvp<x::Native::xServerApi::Messages::BaseMessage> & t={...})  Line 62 C++
  xxxServerAPI.dll!x::Native::xServerApi::Bridge::DistributeMessage(const x::Native::xServerApi::Messages::BaseMessage * message=0x04799248)  Line 99 C++
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:23:56+00:00Added an answer on May 15, 2026 at 1:23 pm

    this works fine:

    std::ostringstream oStringStream;
    boost::archive::xml_oarchive xmlArchive(oStringStream);
    
    xmlArchive.register_type(static_cast<BaseMessage *>(NULL));
    xmlArchive.register_type(static_cast<IncomingTradeMessage *>(NULL));
    xmlArchive.register_type(static_cast<InternalRequestInfo *>(NULL));
    xmlArchive.register_type(static_cast<InternalTradeTransInfo *>(NULL));
    
    
    const BaseMessage* myMessage =message;
    
    xmlArchive << make_nvp("Message", myMessage);
    
    std::string strData = oStringStream.str();
    
    std::istringstream iStringStream(strData,istringstream::in);
    std::string nothing;
    
    //iStringStream. >> nothing;
    
    BaseMessage* x;
    
    boost::archive::xml_iarchive xmlIncomingArchive(iStringStream);
    
    
    xmlIncomingArchive.register_type(static_cast<BaseMessage *>(NULL));
    xmlIncomingArchive.register_type(static_cast<IncomingTradeMessage *>(NULL));
    xmlIncomingArchive.register_type(static_cast<InternalRequestInfo *>(NULL));
    xmlIncomingArchive.register_type(static_cast<InternalTradeTransInfo *>(NULL));
    
    xmlIncomingArchive >> make_nvp("Message",*x);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run into some problems when trying to serialize my object to XML. The
I have an XML file that I'm trying to serialize into an object. Some
I am trying to serialize some Linq objects using this code. private byte[] GetSerializedObj(object
I'm trying to figure out a way to serialize some Django model object to
I'm trying to serialize an object to XML that has a number of properties,
I'm trying to Serialize some Object, that contain an IList with Children Elements. The
I'm trying to serialize some data to xml in a way that can be
I am working on some classes which I need to serialize/deserialize to xml, that
I am trying to serialize an object but I am facing some issues regarding
I am trying to serialize some objects of class InstitutionResultView which is basically wrapper

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.