Web Services


Webservice are required with mobile development.There are no of method through which you can create you web service.
1. REST (Representational State Transfer)
2. SOAP (Simple Object Access Protocol)
3. XML-RPC (Remote Procedure Call uses XML)


Let ‘s give you some overview of the types.
//chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo/RestClient.html
1. REST (Representational State Transfer) : REST Web Services consist of using plain HTTP to make method calls and you get XML or JSON in response.Create webservice using REST is very easy and take less time to make as compare to other.
REST support all most commonly used HTTP methods (GET : Read, POST : Create, PUT : Update and DELETE : Delete).
2. SOAP (Simple Object Access Protocol): SOAP is Simple Object Access Protocol based on XML so it easy to read. It is simple XML based protocol to exchange data between two different language.
3. XML-RPC (Remote Procedure Call uses XML) : XML-RPC protocol is really simple. You pass requests which contain the method name, and parameters formatted in xml that defines their data types. The response comes back with similar xml data.
Here I am going to explain you how to create a basic web service using REST.In this application we can create a user , get user info,update user and delete user.
REST Web services


REST (REpresentational State Transfer) is an architectural style, and an approach to communications that is often used in the development of Web services. The use of REST is often preferred over the more heavyweight SOAP (Simple Object Access Protocol) style because REST does not leverage as much bandwidth, which makes it a better fit for use over the Internet. The SOAP approach requires writing or using a provided server program (to serve data) and a client program (to request data).


REST is often used in mobile applications, social networking Web sites, mashup tools, and automated business processes. The REST style emphasizes that interactions between clients and services is enhanced by having a limited number of operations (verbs). Flexibility is provided by assigning resources (nouns) their own unique Universal Resource Identifiers (URIs). Because each verb has a specific meaning (GET, POST, PUT and DELETE), REST avoids ambiguity.


Web services is one of the most important part of today development where we centralized or data and allow user to access that data from different sources like mobile app,web etc.


Before creating this web service you have basic knowledge about PHP,Mysql and JSON.
1. Install XAMPP OR WAMP in your system.
2. Now you need to create database. Here we create test database and create user table. (copy below code and paste in sql query)
3. Create webservice folder Suppose are you using WAMP server then create like this folder D:/wamp/www/webservice Or For XAMPP server : D:\xampp\htdocs\webservice
4. Create file db_config.php for database configuration.In this file we need to connection to our database.
db_config.php :


5. Now we can create a file to save requested data to database.
create.php :

6. In above code we did not add any validation you can add also validation code.
7. Now we need to install chrome extension for test web service. Here I am using Advanced REST client (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo).
8. Now go to your chrome app store. Click on Advanced REST client.Now add your requests.
Here my url is http://localhost:8081/webservice/create.php
Done!


Now we get user information using GET method.I create new php file (select.php) to get user information.
1. select.php

URL : http://localhost:8081/webservice/select.php?id=1
Now we update user information using PUT method.I create new php file (update.php) to update user information.
1. update.php

We get PUT method value by $_SERVER['HTTP_VARIBLENAME'].

Now we delete user information using DELETE method.I create new php file (delete.php) to delete user.
1. delete.php

Thank you! enjoy coding … :)


13 comments:

  1. Your website is really cool and this is a great inspiring article.
    SEO services pakistan

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. For JSON, these tools will help to debug JSON data http://codebeautify.org/jsonviewer and http://jsonformatter.org

    ReplyDelete
  4. Thanks for the share.We provide high quality and user-friendly services with strong internet marketing plans. Our services include website design, web development, website maintenance, WordPress web design.
    Web Development Company|Joomla Web Development

    ReplyDelete
  5. Thanks for sharing the information. It is very useful for my future. keep sharing. Can you play more games at :
    Signature:
    messenger indir | download messenger |messenger indir | messenger download | messenger indir | messenger indir | messenger | messenger indir

    ReplyDelete
  6. This is a great article. It gave me a lot of useful information. thank you very much. Can you play more games at :
    ninjago games | swords and souls | subway surfers | goodgame big farm | strike force kitty 2 | agario

    ReplyDelete
  7. The war between humans, orcs and elves continues earn to die free hot. Lead your race through a series of epic battles, using your crossbow to fend off foes and sending out units to destroy castleshappy wheels . Researching and upgrading wisely will be crucial to your success! There are 5 ages total and each one will bring you new units to train to fight in the war for you cause. earn to die hotWhatever you do, don’t neglect your home base because you cannot repair it and once it is destroyed, you lose! Age of War is the first game of the series and really sets the tone for the Age of War games . Also try out the Age of Defense series as it is pretty similar.
    In this game, you start at the cavern men’s age, then evolvetank trouble game! There is a total of 5 ages, each with its units and turrets. Take control of 16 different units and 15 different turrets to defend your base and destroy your enemy.
    The goal of the game also differs depending on the level. In most levels the goal is to reach a finish line or to collect tokens. Many levels feature alternate or nonexistent goals for the player. The game controls are shown just under gold mine. Movement mechanisms primarily include acceleration and tilting controls.
    It consists of a total of 17 levels and the challenge you face in each level increases as you go up. unfair mario The game basically has a red ball that has to be moved across the various obstacles in its path to the goal. slitherio

    ReplyDelete
  8. I was working and suddenly I visits your site frequently and recommended it to me to read also. Age Of War 2
    Big Farm | Slitherio
    Tank Trouble | Happy Wheels
    Goodgeme Empire | Slither.io

    ReplyDelete
  9. You are doing a great job. Useful information

    ReplyDelete
  10. Great Work. This post is worth everyone’s attention. web design company in chennai

    ReplyDelete
  11. Informative article, just what I was looking for.seo services chennai

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...