2017 m. spalio 14 d., šeštadienis

SOAP and WSDL

SOAP originally stood for Simple Object Access Protocol, but it is no longer restricted in any way to object access or object-oriented use. Starting with version 1.2, the acronym is no longer officially spelled out; that is, "SOAP" is just a name. Although it originated from an industrial consortium, the XML Protocol Working Group of the W3C now has change control for new versions of SOAP. Here we give an overview of the features that SOAP includes and excludes, examine its relationship to XML, and list the basic SOAP namespaces.


The SOAP 1.1 specification required all services to use a SOAPAction header.

SOAP Faults
SOAP nodes return error or status information to a node from which they have received a message. They send back a SOAP message with a Body Block consisting of the Fault element in the soap-envelope namespace. Fault has two mandatory child elements, "faultcode" and "faultstring," and two optional child elements, "faultactor" and "detail."
  • The "faultstring" element has text content that is intended to be a human-readable explanation.
  • The "faultactor" element (fault actor) has a URI as its content to identify the actor at which the Fault occurred. It is optional only for ultimate receivers. All intermediate nodes generating a Fault element must provide a "faultactor" in any such Fault.
  • The "detail" element provides application-dependent additional information on a Fault generated by processing a message Body. You should not include this element for Header Block errors. Rather, the application must include it if the Body contents could not be processed successfully. Its presence indicates that the ultimate receiver at least processed some of the Body. The content and attributes of the "detail" element are application dependent. It can have an "encodingStyle" attribute. All element children of a "detail" element are called detail entries.
  • The "faultcode" element contains a namespace-qualified name.

Header:
The Header element namespace serves as a container for extensions to SOAP.
No extensions are defined by the specification, but user-defined extension ser-
vices such as transaction support, locale information, authentication, digital sig-
natures, and so forth could all be implemented by placing some information inside
the Header element. Children of the Header element may be annotated with the
mustUnderstand and/or actor attributes.

SOAP HTTP binding
SOAP defines a binding to the HTTP protocol. This binding describes the relation-
ship between parts of the SOAP request message and various HTTP headers. All
SOAP requests use the HTTP POST method and specify at least three HTTP head-
ers: Content-Type, Content-Length, and a custom header SOAPAction.
The actual SOAP message is passed as the body of the request or response.

Content-Type
Content-Type: text/xml; charset=character encoding
The Content-Type header for SOAP requests and responses specifies the
MIME type for the message and is always text/xml. It may also specify the
character encoding used for the XML body of the HTTP request or response. This
follows the text/xml part of the header values.


WSDL

 WSDL - Web Services Description Language .

WSDL provides a way of describing how to make request to SOAP service.

 A programmer would use WSDL to figure out what procedures are available from the SOAP server and what format of XML is expected by that procedure, and then write the code to call it.


The first task in a WSDL file is to define the information that will be sent to and from the service. A WSDL file builds the service up in levels. First, it defines the data to be sent and received, and then it uses that data to define messages.