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 8074067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:32:05+00:00 2026-06-05T14:32:05+00:00

I have been looking for an answer on stackoverflow and on the web more

  • 0

I have been looking for an answer on stackoverflow and on the web more generally for the past two days and I couldn’t find a decent answer. However I am surely not the first one to do that:

I am implementing a p2p overlay in Java. The aim is to exchange messages between peers. The messages are represented by a Message class which contains a sender, a receiver and a content. The content is represented as a class extending a Context interface (for each type of messages a new class extending Context is created which can contain additional fields, it is application specific). The className of the context is also store in the message. However I want to keep the messages transmitted over the network language-agnostic which is why I convert my converted them to a JSON object before transmitting them across the network. So far nothing marvelous.

The questions arise when receiving a message: I receive a JSON object which I assume is of class Message (a type checking is performed). It contains a content of the class stored in the message as a className.

  1. Is it wise to store the classname like that and then create an instance of the class to store the content dynamically when receiving a message (i.e. the content will be an instance of the SpecificContent class but seen as the interface Content). The content will then be available at the application level and can be casted to access its specific methods.

  2. is there any better/standard way to send messages over network without simply serializing the java class? (in this case it could not communicate with a program written in C++, etc ) (without talking about CORBA which is nothing less than a Rube Goldberg machine)

Thank you very much for your time, any comment/question/answer is appreciated.

Regards,

B.F.

  • 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-06-05T14:32:07+00:00Added an answer on June 5, 2026 at 2:32 pm

    Yours is the challenge of integration of heterogeneous systems. What you are doing is loosely the practice being followed (at least in principle).

    The idea that a text based (JSON in your case here) protocol is used to exchange the information between heterogeneous systems, is central to the system-integration or interoperability. In fact the standard practice of web-services is nothing but just this. Here the XML used as text based protocol among heterogeneous system.

    To answer your question:

    1. If you using your own protocol then its fair to send a classname coz that’s where you interpret the message object you received. If you used standard practices like SOAP-Web services, these things are taken care automatically. All you need to define is service-contract of message exchange called WSDL.

    2. XML is the language of internet. Use xml to exchange information over network. For all the widely used languages (Java,C#,PHP etc) ready made programs are available to convert a native language object into equivalent xml representation (e.g Jaxb is used to convert Java object into xml representation).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking around for an answer to my question but couldn't find
I have been looking around for an answer to this, but couldn't really find
I have been looking for an answer to this and could not find it
I have been looking over the web but have not come across an answer
I have been looking everywhere for this answer. I can't find any solution. I
I have been looking for this on Stack Overflow, but couldnt find an answer
I've been looking at this Stackoverflow question and have the answer implemented. It works
I have been looking for an answer for some time now, hope you could
I have been looking at the answer to this question: Pulling details from response
Hey guys i have a question which i have been looking for the answer

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.