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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:44:23+00:00 2026-05-12T10:44:23+00:00

Im pretty new to Java Web Services, but I cant find a good explanation

  • 0

Im pretty new to Java Web Services, but I cant find a good explanation anywhere.

I have 2 Java web projects within NetBeans.
One as a web service and one as a client for that web service.
I have also created my own class called “Person”, which has what you’d expect: name, dob, etc.

I would like to have a web service method called “ListPeople()” that would return an array of “Person” objects.

Do I need to have that class in both projects?
Should I be serializing the object first?
Should I be using JAXB, if so, where do I start?

Sorry for the n00b questions, but im confused.
What is the normal way of accomplishing this?

Thanks in advance

  • 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-12T10:44:23+00:00Added an answer on May 12, 2026 at 10:44 am
    1. Do I need to have that class in both projects? Yes.
    2. Should I be serializing the object first? No.
    3. Should I be using JAXB, if so, where do I start? I would not. I prefer the javax.oxm interfaces, because I don’t care for JAXB, but that’s a personal opinion.

    My personal preference is to use Spring web services. If you happen to be a Spring user, I think that’s the best way to go. If not, perhaps the docs will still help to clarify.

    You’re experiencing the reason why I don’t like your approach: both the service and client and dependent on the class and OXM code. You have to have it in both places, in perfect synchronization. Change one and you have to change both.

    I try to minimize dependencies if I can.

    And in this case you can if you send XML back and forth. Start with an XSD schema. Let the client and service deal with that instead of Java objects. Your service will be usable for clients that aren’t Java that way.

    If you take this approach, you only have to worry about OXM on the server side. You take in the XML request and marshal it into the Java object of your choice and pass it to your service layer (note: NOT web service layer) for processing. Turn the response object into XML response stream and Bob’s your uncle. Let the client deal with that.

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

Sidebar

Related Questions

I'm pretty new to JWS. I have a web application ( several web services
I'm pretty new to Android development, but I have some experience with Java and
I'm pretty new to the java draw functions, but I have a sample histogram
I am pretty new to php, but I am learning! I have a simple
I am new to Java (but have a fair bit of .NET experience). I
I'm pretty new to Java and this has me really confused. I have two
I'm pretty new to java, and using netbeans for design a UI. What I
I am pretty new to Java and the project I have requires a new
I'm pretty new to regular expressions. I have a requirement to replace spaces in
I'm pretty new to Scala, but I thought that one of the strengths of

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.