File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Restful web services in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Restful web services in Java" Watch "Restful web services in Java" New topic
Author

Restful web services in Java

Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 115
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Restful web services in Java
 
Similar Threads
how to use one-to-one association
Struts html:link forwarding
what sould be generator element & where to put save method
constructor with array type.
read text