jueves, 27 de noviembre de 2014

Webservice Example with axis2 part 2: Understanding a webservice

This is the second post to show how to create a web service with a simple operation and a complex operation based on Axis2.

In this series of posts we are going to show this points:

Now we are going to learn how a webservice works and the main concepts.

The main part of a webservice is the WSDL file that describes the webservice interface. This interface describes the available operations in the webservice and the input and output parameters of all operations. This file will be the defined using a template java class and the java2wsld java tool that transform a java class in a WSDL file.

Another important concept of the webservice is the endpoint, the endpoint is an URL that you have to know in order to use the webservice. This endpoint is where the server are listening for your requests and where the server code are executed when a webservice operation is called. Finally an output is returned to the client in order to response to the request, this is the server part of the webservice.

The WSDL file is always public and you can access it via URL to see the available operations and mainly to build a client using the wsdl2code java tool that can create a collection of java classes based on a WSDL file in order to use the webservice. With this client you can invoke the available operation of the webservice, this is the client part of the webservice.

This comunication bettwen the client and the server part of the webservice is made by the soap protocol (Simple Object Access Protocol). 


We have the webservice named Axis2ServiceExample  with the next operation:

Name: simpleOperation
Input Parameters: number1: Integer, number2: Integer
Output Parameters: Integer - Return the add of the input numbers.

WSDL File: http://localhost:9763/services/Axis2ServiceExample?wsdl
endpoint:  http://localhost:9763/services/Axis2ServiceExample/

All of this things are defined in the WSDL file, in the next sections we will see how to the create all parts of the webservice and call to the operation.


No hay comentarios:

Publicar un comentario