This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am writing a RESTful web service which will take a XML file as input and process the same, and save it into database. I am new to RESTful web services(jersey), can anybody please help me how to achieve the things using jersey.
1- Please give any link if you have?
2- Sample code which will help me to undersatnd how I ll post xml to jersey.
3- May be any API where I can learn and do.
4- If we cant not achieve that or not good to do that way please suggest what is the best way to send XML file to my app using webservice.
5- Keep in mind I need a secure web service, I may send user credential with the xml file as a header/element.
Waiting for quick response as it is little urgent for me.
If I understand you correctly, your problem is to create a client program to send a document to a RESTful service as a POST request, right?
You can use the standard library HttpURLConnection to do that - the fact that the document is formatted as XML makes no difference. This has come up before in this forum so do some searching. Doesn't the Jersey download include some client examples?
Rudra Narayan Garnaik
Joined: May 05, 2006
Thanks for your quick response, exactly I want to know how my jersey client lwill post a XML file. Can you please give here some sample code or link for quick reference? I will try my best to search but i am completely new to webservices as well as jersey.
Author and all-around good cowpoke
Joined: Mar 22, 2000
A major point about using RESTful style is that the methods used are exactly HTTP methods as used all over in the web clients and servers. So all you really need to learn is the way a HTTP POST works.