Martin Magakian
Martin Magakian

Reputation: 3766

Send java object to a rest WebService

I'm searching a nice way to send a java object to my rest web service.
It's possible or not ?


For sample I wan't to send an "User" Object to my rest :

public Class User{
    private String name;
    private String surname;

    public getName(){
     return name;
    }

    public setName(String name){

      [...]
 }

It's possible to generate AUTOMATICALY this kind of Rest ?
www.foo.com/createUser/name="foo"&surname="foo"

Upvotes: 5

Views: 5269

Answers (3)

aehlke
aehlke

Reputation: 15840

It's possible to generate AUTOMATICALY this kind of Rest ? www.foo.com/createUser/name="foo"&surname="foo"

That's NOT REST. That's RPC.

Upvotes: 1

Rich Seller
Rich Seller

Reputation: 84078

Have a look at Restlet. The tutorial shows you how to get started.

Restlet allows you to use a number of representation formats, including XML and JSON.

Upvotes: 3

Shimi Bandiel
Shimi Bandiel

Reputation: 5747

I would consider using a JSON representation for this kind of Java objects. I prefer the Jersey implementation of JAX-RS and it has built-in support for JSON serialization over JAXB.

Hope this helps...

Upvotes: 4

Related Questions