wsdl web service description language · information systems engineering, 2008 2. why a service...

27
WSDL Web Service Description Language Mahmoud ElGayyar

Upload: trandiep

Post on 23-Apr-2018

221 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

WSDLWeb Service Description Language

Mahmoud El‐Gayyar

Page 2: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Information Systems Engineering, 2008 2

Why a service description is needed?

Web services must be defined in a consistent manner to be 

discovered and used by other services and applications.

Service description isolates all technical details, e.g., machine‐

and implementation language‐specific elements, away from the 

service requestor’s application and the service provider’s Web 

service. 

Page 3: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Information Systems Engineering, 2008 3

WSDL?

The web services description language (WSDL) is the XML‐based

service representation language used to describe the details of the

complete interfaces exposed by Web services and thus is the

means to accessing a Web service.

Service Provider

Service Requester

WSDL(Contract)

SOAP Messages

Binding

Operationdata

1. what a service does, i.e., the   

operations the service provides, 

2. where it resides: specific 

address

3. how to invoke it, i.e., details of 

the data formats and protocols 

necessary to access the service.

Page 4: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn

WSDL (Web Services Description Language)

W3C‐Standard:

►Old Version: 1.1 (still used, e.g. Axis2)

►New Version: 2.0

Page 5: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Structure of WSDL documents

WSDL documents have distinct sections: 

The service‐interface definition describes the interface structure. This 

contains all the operations supported by the service, the operation 

parameters, and abstract data types.

The service implementation part binds the abstract interface to a concrete 

network address, to a specific protocol, and to concrete data structures. 

► A web service client may bind to such an implementation and invoke the service 

in question.

Information Systems Engineering, 2008 5

Page 6: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Interface Definition

Information Systems Engineering, 2008 6

Operation

Collected in 

PortTypeDefines an abstract service(Endpoint) 

Input/output

MessagePartConsists of

* A input message for an operation with two parameters should have two parts. (Can be only one part with complex type)* An output message for a non void operation should have one part

has 

Type

Simple

Complex

complexType

Page 7: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Interface Definition

Information Systems Engineering, 2008 7

Operation

Collected in 

PortTypeDefines an abstract type (Endpoint) 

Input/output

MessagePartConsists of

has 

Type

Simple

Complex

complexType schema Types

Also it can be defined as an element which contains a complex type.

Page 8: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Interface Definition

Information Systems Engineering, 2008 8

<operation name=“operation2”><input message=“empty”/><output message=“op2_out_msg”/>

<operation/>

<portType name=“portType1”>

</portType>

<operation name=“operation1”>

<operation/>

<input message=“op1_in_msg”/><output message=“op1_out_msg”/>

<message name=“op1_in_msg”>

<message/><message name=“op1_out_msg”>

<message/><message name=“op2_out_msg”>

<message/><message name=“empty” />

<part name=“in_1” type=“type1”/><part name=“in_2” type=“type2”/>

<part name=“op1_out” type=“string”/>

<part name=“op2_out” element=“ele1”/>

<Types><schema>

</schema></Types>

<complexType name=“type1”><sequence>

<element name=“cusNum” type=“integer”/>

<element name=“cusName” type=“string”/>

</sequence/></complexType><element name=“ele1”><complexType>….</complexType>

</element><complexType name=“type2”><sequence>

<element name=“customer” type=“type1”/>

</sequence></complexType>

Can also be imported

Page 9: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

WSDL – Bindung an SOAP über HTTP

style: Defines the structure of the SOAP message content:

Remote Procedure call(rpc) 

oder Messaging (document) ►style="rpc"<soap:body>

<procedure-name><part-1>...</part-1>...<part-N>...</part-N>

</procedure-name></soap:body>

Use WSDL target namespaceValidation is not possible

►style="document"<soap:body>

<part-1>...</part-1>...<part-N>...</part-N>

</soap:body>

Use Schema namespaceValidation is possible

http://www.ibm.com/developerworks/webservices/library/ws‐whichwsdl/

Page 10: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Implementation

Information Systems Engineering, 2008 10

We have defined our web service abstractly and now we need to define how this abstract definition is implemented.

Page 11: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Implementation

Information Systems Engineering, 2008 11

Binding

Specify how the client and the web service should exchange messages. The client use these information to access the web service.

Page 12: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Implementation

Information Systems Engineering, 2008 12

Binding

Protocol

SOAPHTTP

Each protocol has its own  specific elements.

Page 13: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Implementation

Information Systems Engineering, 2008 13

BindingType

Protocol Message Style

Encoding Style

SOAPHTTP RPC

Documentliteralencoded

Literal: SOAP message contains data formatted exactly as specified in the abstract WSDL definition.Encoded: means that the input need to be serialized from xml to other format according to encoded rule defined in encoding style.

Page 14: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Implementation

Information Systems Engineering, 2008 14

BindingType

Protocol Message Style

Encoding Style

SOAPHTTP RPC

Documentliteralencoded

Operation

For every

Obtainedfrom

soapAction

soapAction: is a server‐specific URI used to indicate the intent of request, help to dispatch the message to appropriate service/operation

Page 15: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Implementation

Information Systems Engineering, 2008 15

BindingType

Protocol Message Style

Encoding Style

SOAPHTTP RPC

Documentliteralencoded

Operation

For every

Obtainedfrom

soapAction

Port

Service

Port: is a single endpoint defined as a combination of a binding and a network address – at which the service is made available

Service name

Page 16: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Service Interface Definition

<service name=“TestService”>

<service/>

<port name=“port1” binding=“binding_1”/><soapbind:address location =http://localhost:8080/TestService/>

</port>

<binding name=“binding_1” type=“porType1”>

</binding>

<soapbind:binding style=“rpc” transport=

“http://schemas.xmlsoap.org/soap/http/” />

<operation name=“operation1”>

</operation>

<operation name=“operation2”><soapbind:operation soapAction=“urn:op2”

style=“document”/>

….</operation>

<soapbind:operation soapAction=“urn:op1”/><input>

<soapbind:body use=“literal”/></input><output>

<soapbind:body use=“literal”/></output>

Page 17: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

WSDL 

OperationPort Type

MessageBinding

Port Service

Supports

Input & Output

Provides

How to encode

Formats & Protocols

Implements

What

How

Where

Page 18: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

WSDL 

definitions

binding

message

types ‐ Abstract data types.

‐ Abstract message

‐ Operations

‐ Address

‐ Protocol and encoding

port

service

operation

portType

Page 19: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Axis2 Debugging

best approach  for monitoring and debugging of Web services: 

SOAP messages monitor and manipulation!

Apache TCPMon

http://ws.apache.org/commons/tcpmon

Can view soap messages and generate requests

Axis2 SOAPMonitor

Entirely different way: soapmonitorPhase in Axis2 architecture

SOAPMonitorService receives all messages which can be shown through 

the SOAPMonitorApplet

Page 20: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Axis2 TCPMon Installation

Download from http://ws.apache.org/commons/tcpmon/download.cgi

Unpack and start:

tcpmon.bat 6666 localhost 8080

Admin area for further instances 

Page 21: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Axis2 TCPMon (II)

TCPMon is as an intermediary between the Client and the Webservice. The 

client has to point to the intermediary rather than the original endpoint in order 

to monitor the messages.

Page 22: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Axis2 TCPMon (III)

TCPMon can also be used as a request sender for Web services. The request

SOAP message can be pasted and then sent directly to the server.

Page 23: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn

Axis2 SOAPMonitor Installation

Available already in Axis 2 but not deployed by default.http://ws.apache.org/axis2/1_3/soapmonitor-module.html

The soap monitor depends on a servelt and an applet, and 

therfore we need servlet container (e.g. Tomcat)

The SOAP Monitor can be engaged by inserting the following in 

the  “global modules” section in the axis2.xml file.

<module ref="soapmonitor"/>

Page 24: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn

Axis2 SOAPMonitor Installation

Setting up the soap monitor servlet

To configure the servlet to communicate with the applet, add the following 

to web.xml (the SOAPMonitorPort is configurable) :

Page 25: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn

Axis2 Servlet Activation in web.xml

<servlet>

<servlet-name>SOAPMonitorService</servlet-name>

<display-name>SOAPMonitorService</display-name>

<servlet-class>

org.apache.axis2.soapmonitor.servlet.SOAPMonitorService

</servlet-class>

<init-param>

<param-name>SOAPMonitorPort</param-name>

<param-value>5001</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>SOAPMonitorService</servlet-name>

<url-pattern>/SOAPMonitor</url-pattern>

</servlet-mapping>

Page 26: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn

Axis2 Applet Extraction

SoapMonitor applet is available in Axis2 lib folder and you can 

extract its classes by:

jar –xf soapmonitor-1.3.jar

Or just use a program like 7Zip

Copy all the applet classes into the following folder and restart 

your Tomcat server:

Applet start: http://localhost:8085/axis2/SOAPMonitor

Page 27: WSDL Web Service Description Language · Information Systems Engineering, 2008 2. Why a service description is needed? z. Web services must be defined in a consistent manner to be

Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn

Axis2 SOAPMonitor