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 Access object in Jersey Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Access object in Jersey" Watch "Access object in Jersey" New topic
Author

Access object in Jersey

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

I am using Jersey along with Spring. Now i need to get a XML file as input along with that a user object will also be passed by client. I need to fetch that and return it back without doing anything with that object. Can someone please let me know with some URL of tutorials or by pointing out some classes/methods for that?


Never try to be a hard-worker. Be a smart-worker.
My Blog
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Your question is slightly unclear to me, I understand this much:
1. You have a RESTful web service.
2. There is an XML file.
3. There is a user object.

Questions:
1. What is the resource exposed by the RESTful web service; the XML file or the user object?
2. If the resource is the XML file, then what is the user object to do?
3. If the resource is the user object, then what do you need the XML file for?
Best wishes!
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Ivan Krizsan wrote:Hi
Questions:
1. What is the resource exposed by the RESTful web service; the XML file or the user object?
2. If the resource is the XML file, then what is the user object to do?
3. If the resource is the user object, then what do you need the XML file for?
Best wishes!


1. XML as well as Object.
2. Object contains an aray of datas since the request will be redirected to our system, we need to keep it till the response sent
3.XML File is for data's that user need.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
It sounds like the best thing may be to split things into separate resources.
Perhaps the object also should be split in multiple resources, manipulated using multiple requests.
Then, when manipulating the XML file resource, one or more URIs leading to the item(s) in the object can be supplied, in order to avoid sending the actual data.
Best wishes!
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Ivan Krizsan wrote:Hi!
It sounds like the best thing may be to split things into separate resources.
Perhaps the object also should be split in multiple resources, manipulated using multiple requests.
Then, when manipulating the XML file resource, one or more URIs leading to the item(s) in the object can be supplied, in order to avoid sending the actual data.
Best wishes!


Can you be more specific?
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Ok, guys. is it possible to do so?



Since i am using XML as input type, is it possible for me to get other objects? Say, my input would be XML file and Object.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
As far as I am concerned, the use case you have where you want to have more than basic security (or similar) for a web service would make me consider document-based SOAP web services, with existing security solutions readily available.
Yes, you can create your own resource payloads that you send to a service, which includes a section reserved for security information, but to me it would feel like reinventing (at least part of) SOAP.
Perhaps someone else has a better suggestion?
Best wishes!
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

^^ So you're telling me to use SOAP instead of REST?


Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Rajkumar balakrishnan wrote:^^ So you're telling me to use SOAP instead of REST?

Well, to me it sounds like you want to enclose some security information in XML with each request along with the data of the request, also in XML.
To me this sounds like something suitable for SOAP; security information included in one or more header blocks and the data of the request in the body of the message.
Also, there are already implementations of WS-Security (http://en.wikipedia.org/wiki/WS-Security) available, which relieves you from writing code to implement this mechanism.
Again, someone else may have some better suggestion. I may have misunderstood your requirements.
If you devise a solution using REST, I would be very interested in hearing about it.
Best wishes!
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

^^
Well Ivan, there is not any secured information passed. Just the URL,and some data's like usertype,servicetype etc. But other than these, i have a object which shouldn't be processed by WS at any stage. The only thing is, when a client request a WS, it'll completely redirected to our domain and after finished processing it'll go to client's domain. its like Payment Gateway. Thats why we need to store the object temporarily and pass it back to the client. I need a mechanism to get object as well as XML file.

Did i make the picture clear to you Ivan?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi again!
Well, then, you may want to try to store the object temporarily, as a REST resource, and enclose the URI of the temporary resource when redirecting and, when the object is to be returned to the client, retrieve the temporary object using the URI.
This way you can use REST all the way.
Best wishes!
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

^^

Can you point me out some tutorial???
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Rajkumar balakrishnan wrote:
Can you point me out some tutorial???

No, sorry, I don't know of any tutorial for that.
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access object in Jersey