II Write the WSDL (Web Service Definition Language)
Build a full web service with Axis
WSDL file structure
The Web Service Definition Language allow to define a whole web service :
- service : defines addresses where the SOAP services can be call.
- portType : groups messages for the specified operation. Each operation consists in one input message and one or more output messages.
- binding : defines how to invoke the service.
- message : defines a message. A message can be a request message or a response message.
- types : defines data types shared by both the service provider and the service requester.
A web service can be entirely specified by it's wsdl file.
Service definition
Our web service will be available at the http://localhost:8080/AxisTutorialServer/services/AxisTutorialSOAP URL. It's name is AxisTutorial
Function and messages definition
The AxisTutorial contains the exposed functions signature. The
Messages definition
Both request and response messages are defined as transporting one message part. Each part maps to a specific type.
Types definition
The two main types we are going to use are the GetById and the GetByIdResponse types. The first one is made of a single long attribute named in representing the id of the requested CD. The second one is made of one complex CD element named out and representing the requested CD. The complex CD type maps a CD in our catalog with it's id, name, artistName and publishDate parameters.
Simple types in a xsd schema such as string, date, long, ... could be length or value restricted. For example, we could write :
We wont use this restrictions in our example.
For more information about the Web Service Definition Language check :
- WSDL 1.1 specifications
- WSDL 2.0 specifications
- WSDL tutorial (at www.W3schools.com)