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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:55:27+00:00 2026-05-30T15:55:27+00:00

i have too problems 1: debbuging restTemplate, 2: mapping xml to pojo. here is

  • 0

i have too problems 1: debbuging restTemplate, 2: mapping xml to pojo.

here is my code
Pojo:

@XmlRootElement(name = "parent")
public class Parent {

private User user;

public Parent(){        
}

//getter setter     
}

another Pojo

@XmlRootElement(name = "user")
public class User {

public User(){      
}
private long id;
    private String name;
    private Date registrationDate;  
}

I have an another webservice which return the xml data as :

<parent>
<user id="23" name="name">
<registrationdate>2012-02-27T13:08:31.771-05:00</registrationdate>
</user>
</parent>

I user Spring 3 and restemplate (in my classpath i have jaxb-api and jaxb-impl):
in my appilacation-context i have :

<bean id="restTemplate" class="org.springframework.web.client.RestTemplate"/>

and in my service layer i have :

@Service
public class ParentServiceI implements ParentService{

Logger logger = Logger.getLogger(this.getClass());  

@Autowired
private RestTemplate restTemplate;

public Parent getMoreInfo() {
    logger.info("getting info");
    Parent p = restTemplate.getForObject("http://localhost:3128/dadad.xml", Parent.class);
    logger.info(p.toString());      
    return p;
}}

my first problem :
When i started this code, i certainly had problem with the mapping, but i couldnt debug that, i wasnt able to see any error log, any exception , in my console i only get that :

09:31:50,503  INFO 959993440@qtp159257116-0 ParentServiceI :64 - getting info
09:31:50,670 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:78 - Created GET request for "http://localhost:3128/dadad.xml"
09:31:50,971 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:520 - Setting request Accept header to [application/xml, text/xml, application/*+xml, application/json]
09:31:58,762 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:465 - GET request for "http://localhost:3128/dadad.xml" resulted in 200 (OK)
09:31:58,764 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:78 - Reading [com.mypackage.Parent] as "text/xml" using [org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter@7d6d4e3e]

And that it. no error, the code just stuck there.
i get the first log message “getting info”, i didnt get the 2nd log message
how can i debug that?

my second problem :
after setting the pojo right, i got some result :

09:31:50,503  INFO 959993440@qtp-159257116-0 ParentServiceI :64 - getting info
09:31:50,670 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:78 - Created GET request for "http://localhost:3128/dadad.xml"
09:31:50,971 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:520 - Setting request Accept header to [application/xml, text/xml, application/*+xml, application/json]
09:31:58,762 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:465 - GET request for "http://localhost:3128/dadad.xml" resulted in 200 (OK)
09:31:58,764 DEBUG 959993440@qtp-159257116-0 client.RestTemplate:78 - Reading [com.mypackage.Parent] as "text/xml" using [org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter@7d6d4e3e]
09:31:59,337  INFO 959993440@qtp-159257116-0 serviceI.EquipmentServiceI:83 - Parent [user=User [id=0, name=null, registrationDate=Mon Feb 27 13:08:31 EST 2012]]

everthing is fine eccept the mapping?
how can i fix that?

Thank you

  • 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-30T15:55:28+00:00Added an answer on May 30, 2026 at 3:55 pm

    i didnt find out how to resolve my first version.

    to map that the attribute of xml file, i only need to add an annotation on the getter as

    @XmlRootElement(name = "user")
    public class User {
    
    public User(){      
    }
    private long id;
        private String name;
        private Date registrationDate; 
    
    @XmlAttribute(name="name")
        public String getName() {
            return name;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have had a few problems with log files growing too big on my
I have the problem that my view controller class has too many delegates and
I have spent too much time on this problem and am beginning to think
I have a problem with a Socket connection closing too fast. I was told
I think I have a synchronization problem...It may be too basic..Please help.. I have
I have too many images to be download from net into iPhone? How can
I don't have too much experience with C# so if someone could point me
When designing an application, does there come a point where you have too many
I have a gridview data and this gridview have subgrid too. in the first
Well as I have posted earlier too...I have created a site in two languages.One

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.