Wednesday, 20 September 2017

Web services Questions and Answers


1)What is Web Service?
Ans: Web Service is a software system for communicating two devices over the network.

2) What are the different types of web services?

There are two types of web services

   1.Soap
   2.REST Full 

 3).What is SOAP?

 ANS : SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web services.

4.What are the advantages of SOAP web services?
 ans:
     Ws Security
     Language independent
     Platform Independent

 5.What are the disadvantages of SOAP web services?
ANS : 

           Slow, WSDL dependent.

 6.What is WSDL?

WSDL stands for Web Services Description Language. It is a xml document containing information about web services such as method name, method parameter etc.

7.What is RESTful web services?

REST stands for REpresentational State Transfer. It is a architectural style. It is not a protocol like SOAP.

8. What is the difference between SOAP and REST web services?


    

 9.Can we maintain user session in web services?

ANS: Web services are stateless so we can’t maintain user sessions in web services.

10. What is difference between put and post methods in rest api ?
ANS:
         
Both are used for data transmission between client to server, but there are subtle differences between them, which are:


 Analogy:


·        
PUT i.e. take and put where it was.
·         POST as send mail in post office.



Social Media/Network Analogy:

·         Post on social media: when we post message, it creates new post.

·         Put(i.e. edit) for the message we already Posted.

 For More details :
 
https://restfulapi.net/rest-put-vs-post/

11. What are the methods support for REST API ?

ANS :   HTTP Methods Supported by Rest Api are :

GET

It requests a resource at the request URL. It should not contain a request body as it will discard. May be it can  cach locally or on the server.

POST

    It submits information to the service for processing; it shall typically return the modify or new resource

PUT/Patch

To update existing resource 

DELETE

To delete a resource

OPTIONS

It indicates which techniques are supported

HEAD

About the request URL it returns meta information


 HTTP STATUS CODE SUPPORTED BY REST ARE:

200-

OK

201-

Created

304-

Not Modified

400-

Bad Request

401-

Unauthorized

403-

Forbidden

404-

Not Found

422-

Un processable Entity

500-

Internal Server Error

If you are going to build an android application (it can be any other mobile platform or web too) that manages all the user data on a central database, REST API will be good architectural option to do the communication between the app and the server.

12.What is difference between PUT and PATCH methods ?

  PUT  Method :

   PUT is a method of modifying resource where the client sends data that updates the entire resource. It is used to set an entity’s information completely

    For example, when you want to change the first name of a person in a database, you need to send the entire resource when making a PUT request

To make a PUT request, you need to send the two parameters; the first and the last name

PATCH Method:

Unlike PUT, PATCH applies a partial update to the resource.
This means that you are only required to send the data that you want to update, and it won’t affect or change anything else. So if you want to update the first name on a database, you will only be required to send the first parameter; the first name.

 

 

No comments:

Post a Comment