Webservice:
Bottom-up:
- Generate the webservice by using the existing code.
- Require little or no knowledge of wsdl or xml.
Top-down:
- Generate the webservice from existing wsdl file.
- Server side and client side development can be done simultaneously.
· Types
· Messages
· Operation
· Port type
· Bindings
· Services
· Ports
Major element:
An WSDL document describes a web service. It specifies the location of the service, and the methods of the service, using these major elements:
Types:
define the data types used by the webservice [Machine-and language-Independent type definitions.
Message:
Parameters and messages used by method.
Contains function parameters (Input are separate from outputs) or document descriptions.
define the messages used by webservice.
Port type:[operation]
Abstract interface definition - each operation element defines a method signature.
define the operations performed by the
webservice.
Refers to message definitions in messages section that describe function signatures(Operation name, Input parameters, Output parameters).
Binding:
Binds abstract methods to specific protocol.
Defines communication protocols used by the webservice.
Service: Port
A service is collection of ports.
A port is specific method and its URI.
Port: specifies an address for a binding, thus defining a single
communication endpoint.
Service: used to aggregate a set of related ports.
Operation Types:
One way and request-response type is the
most common operation type, but
The request-response type is the most common operation type, but WSDL
defines four types:
The main structure of a WSDL document looks like this:
WSDL
Example:
WSDL
Elements
A WSDL document contains the
following elements −
·
Definition − It is the root element of all WSDL documents. It defines the name of the web
service, declares multiple namespaces used throughout the remainder of
the document, and contains all the service elements described here.
· targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
· xmlns="http://schemas.xmlsoap.org/wsdl/"
· xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
· xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
· xmlns:xsd="http://www.w3.org/2001/XMLSchema">
· ................................................
What is targetNamespace WSDL?
targetNamespace is the logical namespace for information about this service. WSDL documents can import other WSDL documents, and setting target Namespace to a unique value ensures that the namespaces do not clash.
The targetNamespace is
a convention of XML Schema that enables the WSDL document to refer to itself.
It is the one which uniquely identifies the WSDL and when
the WSDL is used it should be identified using its Target Namespace
targetNamespace is the logical namespace for information about this service. All the WSDL elements, such as <definitions> , <types> and <message> reside in this namespace.
xmlns:xsd and xmlns:soap are standard namespace definitions that are used for specifying SOAP-specific information as well as data types.
we can conclude that definitions –
-> Specifies that this document is called HelloService.
->we have specified a targetNamespace of http://www.examples.com/wsdl/HelloService.wsdl
default namespace
->specifies a default namespace: xmlns=http://schemas.xmlsoap.org/wsdl/.
All elements without a namespace prefix, such as message or portType, are therefore assumed to be a part of the default WSDL namespace.
->specifies numerous namespaces that are used throughout the remainder of the document.
·
Data types − The data types to be used in the
messages are in the form of XML schemas.
·
Message − It is an abstract definition of the
data, in the form of a message presented either as an entire document or as
arguments to be mapped to a method invocation.
è Each Web Service has two messages: input and
output.
è Each message contains zero or more <part> parameters,
one for each parameter of the web service function.
Each <part> parameter associates with a concrete type defined in the <types> container element.
·
Operation − It is the abstract definition of
the operation for a message, such as naming a method, message queue, or
business process, that will accept and process the message.
·
Port type − It is an abstract set of operations
mapped to one or more end-points, defining the collection of operations for a
binding; the collection of operations, as it is abstract, can be mapped to
multiple transports through various bindings.
è <portType> can combine
one request and one response message into a single request/response operation.
·
Binding − It is the concrete protocol and
data formats for the operations and messages defined for a particular port
type.
è The bindings can be made available via multiple
transports including HTTP GET, HTTP POST, or SOAP.
è The bindings provide concrete information on what
protocol is being used to transfer portType operations.
è The bindings provide information where the service
is located.
è For SOAP protocol, the binding is <soap:binding>,
and the transport is SOAP messages on top of HTTP protocol.
·
Port − It is a combination of a binding and a network address,
providing the target address of the service communication.
·
Services − It is a collection of related
end-points encompassing the service definitions in the file; the services map
the binding to the port and include any extensibility definitions.
·
Note: target namespace to declare self-document
·
Default
namespace to declare xsl document which belong to xml. No prefix is added for
default.
What is the
difference between concrete and abstract wsdl?
Concrete:
It provides specific details about the message format, protocol, and endpoint addresses, making it ready for immediate implementation.
-> It means WSDL has its own endpoint inside it .
Concrete Description:-
It contains Abstract WSDL + Bindings and Services
Bindings: Specifies bindings of each operation in the portType section.
Services:- Specifies port address of each binding.
Besides the information about how to communicate to the web service,
it the information on where the service exist.
It has
Bindings (Protocol the message should be sent) and Services(has endpoint for
each bindings) .
used in client side
Binding and service
Abstract:
-> Abstract wisdl is a wsdl which do not have endpoint uri or location of wsdl .
It has information about how to communicate to the web service like types (Schema),
Message (input and output messages service accepts) ,
Operations (operation that can be performed on this service) and port
Type.
Used in server side
Reusable
No binding details (binding & service)
Type, message, port type defined
WSDL is divided into Abstract and Physical (concrete) portions
->
Abstract:(what it provides)
<definations>
<types>
</types> //Data type
definitions
<message> </message> //Definition of data being communicated /
<operation> </operation> //operations (messages)
<porttype> </porttype> // set of operations / Refers to message definitions in messages section that describe function signatures(Operation name, Input parameters, Output parameters).
Concrete/Physical
: how to consume it
<binding> </binding> // Protocol of data format specification
//Specifies bindings of each operation in the portType section.
<service> </service> // url to access WS /Specifies port address of each binding.
</definations>
- Concrete wsdl: how to consume it.(if you want to expose your service to source system )
- Ex: Additional: High Level flow (wsdl)
<types> reference to the schema </types>
<message name="additionrequestmessage">
<part name="parameter1" element="abcRequest">
</message>
<message name="additionresponsemessage">
<part name="parameter1" element="abcResponse">
</message>
<porttype>
<operation name="addition">
<input message="additionrequestmessage">
<output message="additionresponsemessage">
</operation>
</porttype>
->
schema
<element name="abcRequest">
<complexType>
<element name="input1" type="int">
<element name="input2" type="int">
</complexType>
<complexType>
<element name="output" type="int">
</complexType>
</schema>
What is the
difference between Async and Sync activity on wsdl level?
· Async wsdl- It has only input
messages for the operation and it has 2 operations one for sending the request
and other for call back.
· Sync wsdl-It has 2 messages input and output messages for the wsdl operation.
Q)
if we are calling a wsdl from MDS(runtime),i.e wsdl we are
calling is abstract or concrete how could we know
-> (abstract wsdl)
Your
composite will have 2 sections - reference & binding.
Your reference will point to abstract
WSDL which is used while loading composite references during startup.
Service
binding in your SOA composite will have the actual concrete WSDL.
Q) what is the disadvantage of having concrete WSDL in
the MDS instead of abstract. so that I need to remove the binding and service
parts of the wsdl before I store them in the MDS.
At design/load time, the composite only needs types, messages and port related information and is already available in the concrete wsdl stored in the MDS. What is the disadvantage of having binging and service information in the MDS wsdl?
-> Think of a situation where the service has been moved/upgraded - typically in such scenario the service endpoint changes but contract still remains the same.-> We don't want to store the concrete wsdl (with actual service endpoint) in MDS, hence we decouple the service from its contract - Abstract WSDL helps with this design.
-> Your SOA composite will have the reference pointing to abstract WSDl and the service binding will reference the concrete WSDL.
Q) Why do we
need to have messages in WSDL, aren't operations and types enough to describe
the parameters for a web service?
Messages consist of one or more logical parts. Each part is
associated with a type from some type system using a message-typing attribute.
The set of message-typing attributes is extensible.
The element describes the data being exchanged between the
Web service providers and consumers. Each Web Service has two
messages: input and output.
The input describes the parameters for the Web Service and
the output describes the return data from the Web Service.
Each message contains zero or more parameters, one for each
parameter of the Web Service's function.
Each parameter associates with a concrete type defined
in the container element. So describing the parameters cannot performed by operations
and types this is the main need of Messages.
Q) Whether
two XSD files can be imported, which are having same elements and same file name
?
Yes, we can if they have different
targetNamepsace.
Q) What is the
difference between xsd:import and xsd:include?
The fundamental difference between include and import is that you must use import to refer to declarations or definitions that are in a different target namespace
and you must use include to refer to declarations or
definitions that are (or will be) in the same target namespace.
Q) What is a
inline schema?
Schema can be included inside of XML file is called Inline
Schemas.
Each
partner link has WSDL file with following details:
1.
Partner link type: which is associated with roles
2. Roles:
which describe the port type.
3. Port
type: which associate with a operations and message structure required to
perform this operation.
Four operation patterns supported by WSDL 1.1
1. One-way
2. Request - response
3. Solicit - response
4. Notification
No comments:
Post a Comment