• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Restful web services in Java

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I am invoking Restful web service in Java. The message body is simple xml

<Account>
<AccNo>123</AccNo>
<Name>Ram</Name>
</Account>

and the server side, i have POJO class for this.

public class Account {
private String name;
private String accNo;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return accNo;
}
public void setAge(String age) {
this.accNo = age;
}
}

What i want to know is how to map payload(xml) and pojo in Resource class's method (Restful).

Example:

POST
@Produces("text/xml")
public AccountDetails postAccountXML(Account account)
{
return ...
}
This is not working, please tell me how can resolve in Restful. the mapping between soap message body(payload) and Account class mapping is working
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's where JAXB comes into play. See http://www.vogella.com/articles/REST/article.html or search for "jaxb jersey java" for others tutorials.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should follow restful webservice jersey in java , here you will find all config which is needed to developer JAX-RS api
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic