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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:42:06+00:00 2026-05-26T14:42:06+00:00

When invoking a method in server side I can get a list of errors

  • 0

When invoking a method in server side I can get a list of errors or warnings if something is wrong with some of the parameters, or a correct answer if everything is ok.

For example, I send an object defined at client side to the server, where I have the logic to validate if that object is ok, so I can return a list of errors and warnings related to the object definition to the client so he can correct them properly, or, if the validation goes through, something saying that everything was ok.

Possible solution: I could return a List of Errors, so, when everything goes ok the list is empty, and when I have some errors or warnings I can handle them and show them to the user.

Is this approach correct? Is there any design pattern to do this in a better way? My background is a client-server architecture and I will be using EJBs invoked from client side using Business Delegate pattern to design the communication.

  • 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-26T14:42:06+00:00Added an answer on May 26, 2026 at 2:42 pm

    If the client is able to send objects to EJBs, then it’s probably a client written in Java. So it’s in fact a rich presentation layer that invokes the EJB methods. If so, then the validation should be done in this presentation layer, IMO.

    It might be desirable for the server to add an additional layer of validation for its own safety, but in this case, since the contract of the method is well-defined and the presentation layer is supposed to validate the objects and respect the contract, I would just throw a runtime exception at the first error found.

    If you really want to perform the validation at server side, I would use a checked ValidationException to signal a list of errors. This exception could contain a list of messages, or a list of message keys with associated parameter values. That would depend on the necessity of internationalization (i18n), and who is responsible for i18ning the messages.

    Warnings can also be put in this exception (the message would then be associated with a flag or enum). If the client invokes the method with ignoreWarnings = false, then warnings are stored in the exception and the exception is thrown. If it invokes the method with ignoreWarnings = true, then warnings are ignored and only errors lead to an exception being thrown.

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

Sidebar

Related Questions

I have a method invoking bean which calls a method to perform some sort
I am invoking PHP cURL method on a server and the response is XML
My question is based around invoking a server method by using the command pattern.
I ran into a situation today where Java was not invoking the method I
Suppose I want to throw a new exception when invoking a generic method with
I have a 'generic' boiler plate static method for checking for InvokeRequired and invoking
When invoking a WCF service asynchronous there seems to be two ways it can
What's the correct way to prevent invoking (creating an instance of) a C type
I created a WCF SOAP service using VS 2008 that works server side. I
I'm trying to make a class to handle invoking methods on a remote server

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.