This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Restful java client

 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i want to know how can i genere xsd files from class files in order to have right response in my client rest.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think that is necessary?

What class files are you talking about?

RESTful services can return any resource - not like SOAP services so XSD does not apply.

Various attempts to come up with abstract descriptions of RESTful services seem to be going nowhere. The big services like Amazon depend on text descriptions plus example code.

Bill
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my client rest, i should have a list of person, how can i get some properties of each person (eg name)..
thanks a lot
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't that depend entirely on what format the service sends the data in?

What information do you have about the service?

 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's my problem! In the classe ressource of Person, get method return a PersonConverter jaxb... how the client rest should know about the PersonConverter
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who is in charge of this web service you are trying to access?

What kind of documentation do you have on the implementation of the service?

Bill
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm implementing both rest WS and client. i'm wondering about tech to use in order to assure the communication between the two projects.
thans for your help, i really nedd it.
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
should i use @provider annotation in my service class?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If you have already chosen RESTstyle web service, then one of the few things remaining to decide on is the format of the representation generated by the service.
XML and/or JSON.
In order to be able to decide, I would examine whether the client platform and server platform (for instance Java or .NET) have some suitable library for efficient marshalling and unmarshalling of the representation format you prefer.
If the server is to be implemented in Java, then a question is whether you want to deploy it as a standalone application or in a web container like Tomcat?
I would implement a standalone Java server using the Restlet framework. For a service that is to be deployed in a container, I would choose some framework that implements JAX-RS.
Best wishes!
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm actually using netbeans with glassfish and jersey. Please, what do you mean by "some suitable library for efficient marshalling and unmarshalling of the representation format you prefer"
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Ivan said!

Another alternative to XML or JSON is a simple text file in the "properties" style - one line per value - "name=value"

The initial question here started way way too close to the problem with some assumptions about the technology which turned out to be a false trail. The best way to get good answers here is to back off a bit and state the problem in more general terms.

Bill
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
can you give me your suggestion more clearly. i'm novice in this domain.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Essentially my suggestion is to state your problem in terms which have a minimum of assumptions about particular technology such as JAXB.

You apparently have data managed by a server which you would like to expose as a RESTful service.

You want to do a GET type HTTP request which tells the server which record to return. ? by the person name ?

The server should return certain information to the client in a format which will be easy to interpret for the client to use.

Seems to me the format depends on how complex the data is, so give an example.


Bill
(Have you run through any to the Jersey samples? As I recall there is a nice variety)
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for alls!
your answers were very helpful! all the treatments must be in the service description. My problem is resolved.
Oumaya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic