• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with REST web service

 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello members,

I am developing an android app! Thought of using REST webservice with PHP to connect with remote database. I am a newbee to this. anybody with some example code on connecting login table with REST & PHP would help me a lot...

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A RESTful web service does not care where the requests come from so the fact that Android is involved is not important.

The real question is, what on the server that can talk to a database is under your control??

Bill
 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's so nice Brodgen.

can you give me some examples on REST to connect to a remote database...?
 
Tim Moores
Bartender
Posts: 2792
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mentioned else where in another question you asked, DBs are not accessible via HTTP. You'll need to route the call through an HTTP server. One possibility would be a servlet container like Tomcat that runs the RESTful service using a library such as Jersey.
 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim Moores thanks a lot..

Any other possibilities of accessing the DB's through HTTP server?? please mention so that i can select the best and easy one for me!!
 
Tim Moores
Bartender
Posts: 2792
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's best for you depends on lots of circumstances about which we know nothing. Maybe start by telling us why you think the approach I mentioned might not be a good one in your situation.
 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no clue about library Jersey. I have time to complete project. Let me finish with the easiest things.

Would you tell me how to call a webservice from android...?
 
Tim Moores
Bartender
Posts: 2792
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling a RESTful WS from Android is pretty easy, as it has the capable Apache Commons HttpClient library built in. There are lots of example on how to use it around on the web; there's nothing Android-specific about it.
 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes understood. Thanks a lot people. I also studied some books and got help from frnd.
How to consume webservices in java?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charan Kumar Br wrote: How to consume webservices in java?


That depends on the web service, doesn't it?

SOAP web services typically publish a WSDL which can be used to create a client.

RESTful web services typically publish a text description and example client code.

Bill
 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fine. how to consume RESTful webservices on java??? If any example code, please send me..
 
Amit Bathla
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charan, I would suggest, you please read the basics about web serivces before consuming/building it.
 
Tim Moores
Bartender
Posts: 2792
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charan Kumar Br wrote:how to consume RESTful webservices on java??? If any example code, please send me..

Did you read my previous reply? What further questions do you have?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
There are many web service tutorials, including for RESTful web services, here: http://netbeans.org/kb/trails/web.html
Best wishes!
 
Charan Kumar Br
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ivan!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic