Reference on w3schools.
What is WSDL?
- WSDL stands for Web Services Description Language.
- WSDL is written in XML.
- WSDL is used to describe and locate Web services.
- WSDL is a W3C recommendation.
||A container for data type definitions used by the web service. For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.
||A typed definition of the data being communicated. Can have several parts. See example.
||A set of operations supported by one or more endpoints. Like module or class.
||A protocol and data format specification for a particular port type. Defines the data format and protocol for each port type.
Example: "glossaryTerms" has an operation "getTerm", which needs input and output defined in the two message parts.
<part name="term" type="xs:string"/>
<part name="value" type="xs:string"/>
<binding type="glossaryTerms" name="b1">
- binding.type points to the port for the binding.
- The soap:binding element has two attributes - style and transport. The style attribute can be "rpc" or "document". In this case we use document. The transport attribute defines the SOAP protocol to use. In this case we use HTTP.
- The operation element defines each operation that the portType exposes. For each operation the corresponding SOAP action has to be defined. You must also specify how the input and output are encoded. In this case we use "literal".
One-way The operation can receive a message but will not return a response
Request-response The operation can receive a request and will return a response
Solicit-response The operation can send a request and will wait for a response
Notification The operation can send a message but will not wait for a response
What is SOAP?
- SOAP stands for Simple Object Access Protocol
- SOAP is a communication protocol for communication between applications, a format for sending messages
- SOAP is platform, language independent
- SOAP is based on XML
- SOAP is simple and extensible
- SOAP allows you to get around firewalls
- SOAP is a W3C recommendation
- It is important for application development to allow Internet communication between programs.
- Today's applications communicate using Remote Procedure Calls (RPC) between objects like DCOM and CORBA, but HTTP was not designed for this. RPC represents a compatibility and security problem; firewalls and proxy servers will normally block this kind of traffic.
- A better way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this.
- SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
A SOAP message is an ordinary XML document containing the following elements:
- An Envelope element that identifies the XML document as a SOAP message
- A Header element that contains header information
- A Body element that contains call and response information
- A Fault element containing errors and status information
Here are some important syntax rules:
- A SOAP message MUST be encoded using XML
- A SOAP message MUST use the SOAP Envelope namespace
- A SOAP message MUST use the SOAP Encoding namespace
- A SOAP message must NOT contain a DTD reference
- A SOAP message must NOT contain XML Processing Instructions
Skeleton SOAP Message
The xmlns:soap Namespace
Notice the xmlns:soap namespace in the example above. It should always have the value of: "http://www.w3.org/2001/12/soap-envelope".
The namespace defines the Envelope as a SOAP Envelope.
If a different namespace is used, the application generates an error and discards the message.
curl -X POST -H "Content-Type: text/xml" -H "SOAPAction: \"http://api.eyeblaster.com/IAuthenticationService/ClientLogin\"" --data-binary @request.xml https://sandbox.mediamind.com/Eyeblaster.MediaMind.API/V2/AuthenticationService.svc
curl --data-binary data
(HTTP)This posts data exactly as specified with no extra processing whatsoever.
If you start the data with the letter @, the rest should be a filename.
Data is posted in a similar manner as --data-ascii does, except that newlines are preserved and conversions are never done.
SOAP HTTP Binding
HTTP request message:
POST /item HTTP/1.1
And the HTTP response message:
While when error,
400 Bad Request
- SOAP HTTP Binding: A SOAP method is an HTTP request/response that complies with the SOAP encoding rules: HTTP + XML = SOAP.
- A SOAP request could be an HTTP POST or an HTTP GET request.
- The HTTP POST request specifies at least two HTTP headers: Content-Type and Content-Length.
POST /item HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
For a complete SOAP example, see this.