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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:52:35+00:00 2026-06-09T06:52:35+00:00

I am using jaxb for the Unmarshalling Process This is my Request <kiran acct

  • 0

I am using jaxb for the Unmarshalling Process

This is my Request

<kiran acct = "1234567" />

package com;
@XmlRootElement(name = "kiran")
@XmlAccessorType(XmlAccessType.FIELD)
public class CustAcct {

    @XmlAttribute
    private String acct;

    public CustAcct() {

        super();
    }

    public String getAcct() {
        System.out.println("The New Getter Method of Account is called");
        return acct;
    }

    public void setAcct(String s) {
        System.out.println("The New Setter Method of Account  is called");
        acct = s;
    }

}

This is the way Jersey (Restful Framework ) automatically binds the data with JAXB

public class HelloService {

    @POST
    @Produces("application/text")
    public String sayPlainTextHello(CustAcct custdata) {

        System.out.println("The New Account is " + custdata.getAcct());
        return "Hi";
    }

}

Here my question is that , why the Setter Method setAcct is not getting called in this case ??

I mean why the Line “The New Setter Method of Account is called” isn’t being printed , and where as the Line inside the getMethod is geting called (The New Getter Method of Account is called)

Basically I want to Manupulate Data to an Attribute which is sent in the Request XML .

is there any call back method by which i can control the way Data is being Set ??

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-06-09T06:52:36+00:00Added an answer on June 9, 2026 at 6:52 am

    why the Setter Method setAcct is not getting called in this case ??

    Because you set the access type to field: @XmlAccessorType(XmlAccessType.FIELD). Change it to @XmlAccessorType(XmlAccessType.PROPERTY)

    XmlAccessType javadoc.

    is there any call back method by which i can control the way Data is being Set ??

    Yes. You have complete control on the marshall/unmarshall process when you use adapters.

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

Sidebar

Related Questions

I am Using JAXB , and this is my XML Request and the below
I am trying to create java objects from xml file. I am using jaxb(unmarshalling)
I'm facing a marshalling/unmarshalling problem involving inheritance and polymorphism using MOXy's JAXB implementation and
I have this schema and i'm using JAXB to generate java stub files. <?xml
When unmarshalling using jaxb, I have in class A something along: public class A
I have always been using jaxb for parsing XML files into java object. This
I'm using JAXB with Scala, my marshalling code looks like this: def marshalToXml(): String
I am doing this using JAXB to unmarshall some XML into Java objects: My
The below is my JAXB Binding class which i am using during JAXB Unmarshalling
I have some problem when unmarshaling a .xml at a web service using JAXB.

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.