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

  • Home
  • SEARCH
  • 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 6622335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:23:33+00:00 2026-05-25T21:23:33+00:00

I am trying to implement a request/response client. Here is the basic implementation for

  • 0

I am trying to implement a request/response client. Here is the basic implementation for it.

Class Request
{
    prepareRequest1();
    prepareRequest2();
}

Class Response
{
    processResponse1();
    processResponse2();
}

Class Client
{
    connect();
    sendRequest();
}

myrequest = new Request();
client = new Client (myserver);
my $rawResponse1 = client.sendRequest (myrequest.prepareRequest1());

myresponse = new Response();
myresponse.processResponse1 ($rawResponse1);

I have three classes namely – Request, Response and Client. Request class contains a function specific to a request. These request are the XML requests. There XML request does not have anything in common except few initial tags (e.g. sessionid etc). All other XML parameters are specific to the type of request. So, Currently I am handing it by creating a separate function for each request. I understand that it has a scalability issue, but please suggest me some other best approach I can apply here.

Similar to the request, the response to each request require a specific treatment. so I have a separate function specific to each type of response I am expecting. Generally you can assume that there is a 1:1 mapping between request and response.

Last is the Client class which hands for connection.

I have almost 50+ such request and response, and I am planning to implement with this approach. As I am in initial stage of development, please suggest me some improvement/best practices to implement such request/response.

  • 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-25T21:23:34+00:00Added an answer on May 25, 2026 at 9:23 pm

    Its best if you keep the mapping of the request and response outside of your code. Easier to manage. Keep an xml config file that stores the class names of your request and response tied to a particular type of xml message. You can then obtain the class names and go to that class to process your request and response. Its best to have separate classes to handles these messages rather than separate methods. Thats more scalable. Ensure you have interface for all your request classes and the same for your response classes. This will make it easy to swap your request responses classes easily by modifying the xml config file..

    Hope you got it 🙂

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

Sidebar

Related Questions

I'm trying to implement a Polymorphic Queue. Here is my trial: QQueue <Request *>
I'm trying to implement a simple client-middleware-database architecture, where the client send the request
I'm trying to implement the Basic example for the GwtUpload library, as found here
I am trying to implement a request to an unreliable server. The request is
I am trying to implement a simple request to Wikipedia's API using AJAX (XMLHttpRequest).
I am trying to implement a session-per-request pattern in an ASP.NET MVC 2 Preview
I'm trying to implement a basic web server in Java. When I direct a
I'm trying to write a string to a socket (socket is called response). Here
I'm trying to implement a chat client using JavaScript. The client is constructed using
I am trying to implement PayPal IPN functionality. The basic protocol is as such:

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.