wsdl web service description language · information systems engineering, 2008 2. why a service...
TRANSCRIPT
WSDLWeb Service Description Language
Mahmoud El‐Gayyar
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.
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.
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
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
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
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.
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
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/
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.
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.
Service Implementation
Information Systems Engineering, 2008 12
Binding
Protocol
SOAPHTTP
Each protocol has its own specific elements.
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.
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
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
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>
WSDL
OperationPort Type
MessageBinding
Port Service
Supports
Input & Output
Provides
How to encode
Formats & Protocols
Implements
What
How
Where
WSDL
definitions
binding
message
types ‐ Abstract data types.
‐ Abstract message
‐ Operations
‐ Address
‐ Protocol and encoding
port
service
operation
portType
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
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
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.
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.
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"/>
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) :
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>
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
Dr. Serge Shumilov, Institut für Informatik III, Universität Bonn
Axis2 SOAPMonitor