Date post: | 27-Jun-2015 |
Category: |
Technology |
Upload: | baabtracom-no-1-supplier-of-quality-freshers |
View: | 776 times |
Download: | 1 times |
Website
• Response will be in HTML
• Accessed by humans via web browsers
User browsing websites in HTML
Application running on Web server
HTTP request
HTML response
Web Service
• A Web service is a method of communications between two
software applications over the World Wide Web.
• Web services are Accessed by programs/Applications.
• Response will be in XML or JSON
HTTP/ SOAP / REST request
Response in XML / JSON
Another application running on Web server
Some Application running on a Web server
Consider the Scenario
• Suppose you have a travel and tourism application from which users will get
updates on flight timings, train timings etc
• But for this to be practical- your application must be integrated with the
applications of all the airlines(air india, Jet air, King fisher etc) and for the train
also which is almost impractical or quire a highly expensive method
• So what you do? You go to airlines website, copy the flight times available and
enter that data on your travel application, so those details will be available to
users of your application !!
Application server of emirates airlinesApplication server of your travel application
Copy the details from airlines website
enter the details of airlines in your travel application
Application server of emirates airlinesApplication server of your travel application
SOAP/HTTP/REST Webservice
User get updates on the flight details from your travel application
Using Web service
Benefits of Web Service
• Exposing the existing function on to network, so that any
software's can access
• Low Cost of communication
• Connecting Different Applications ie Interoperability. This in
turns make it possible to access the data exposed by an
application(developed in any programming language say .Net) by
another application(developed in any other language say
android/IOS/PHP etc)
Web Service Data Format Types
• The following standard data format types are supported by Service
via the HTTP protocol
• SOAP
• JSON
• CSV
• EXCEL
• XML
• RSS
Web Service Data Format Types
• The following standard data format types are supported by Service
via the HTTP protocol
• SOAP
• JSON
• CSV
• EXCEL
• XML
• RSS
We will be learning about web services using json as it is the advanced methodology using
in the industry
JSON
• JavaScript Object Notation.
• JSON is syntax for storing and exchanging text information.
• JSON is language independent.
• JSON uses JavaScript syntax for describing data objects.
• JSON parsers and JSON libraries exists for many different
programming languages.
JSON Objects
• JSON objects are written inside curly brackets,
– Objects can contain multiple name/values pairs:
{ "firstName":"John" , "lastName":"Doe" }
• JSON arrays are written inside square brackets.
– An array can contain multiple objects:
{"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }]
}
JSON Example<body>
<h2>JSON Object Creation in JavaScript</h2>
<p>
Name : <span id="jname"></span> <br />
Age : <span id="jage"></span> <br />
</p>
<script>
var JSONObject= {"name":"John Johnson“,"age":33};
document.getElementById("jname").innerHTML=JSONObject.name;
document.getElementById("jage").innerHTML=JSONObject.age;
</script>
</body>
JSON WEB SERVICE
• Having the JSON object available as a data format for web services
means that you can create (insert), update, and query any data in
the web service in JSON object format, and get results in the same
format
If this presentation helped you, please visit our page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)Mavoor Road, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550
NC Complex, Near Bus StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550
Start up VillageEranakulam,Kerala, India.
Email: [email protected]