05 - WSDL 2.0 Interface Element

The interface element describes the different operations supported by the Web Service. Every operation defines an interactive relationship between the client and the web service. Every operation defined by the WSDL can be called from a client with a request call.

The following is an example of the interface element in a WSDL 2.0 file. 

<interface name = "myServiceInterface">
    <fault name = "dataFault" element = "stns:dataError" />
    <operation name="checkServiceStatusOp"
            pattern="http://www.w3.org/ns/wsdl/in-out"
            style="http://www.w3.org/ns/wsdl/style/iri"
            wsdlx:safe = "true">
        <input messageLabel = "In" element = "stns:checkServiceStatus" />
        <output messageLabel = "Out" element = "stns:checkServiceStatusResponse"/>
        <outfault messageLabel = "Out" ref = "tns:dataFault" />
    </operation>
</interface>

Interface

An interface element has the following attributes:

<interface name = "myServiceInterface">

As explained before a WSDL can have multiples interfaces defined in the same WSDL file, so each interface must have a unique name. This name attribute is used for declaring this unique name for the interface.

Fault

A fault element has the following attributes:

<fault name = "dataFault"

The name attribute in the fault element defines the name of that particular fault and the name of a fault must be unique within the interface. This is required so when an operation is defined, so an operation can reference to any defined fault by name.

element = "stns:dataError"/>

The element attribute in the fault element specifies the schema type (defined previously in the types section) of the fault message.

 

Operation

An operation element has the following attributes:

<operation name = "checkServiceStatusOp"

The name attribute defines the name of the operation. With this name you can reference it when defining the bindings. Every operation name must be unique within the interface element.

pattern = http://www.w3.org/ns/wsdl/in-out

The pattern attribute defines the message exchange pattern that the operation will use. It can take the any of these values: in, out, in-out.

style = "http://www.w3.org/ns/wsdl/style/iri"

The style attribute indicates which XML schema the input message will follow.

wsdlx:safe = "true" >

The wsdlx:safe attribute indicates that the operation is safe to call without an obligation on the client in any way. For instance, the client is not agreeing to buy something.

Input

The input element defines an input message, describing the expected input data in the operation. It references to an XML element defined in the types element of the WSDL.

It has the following attributes:

<input messageLabel = "In"

The messageLabel attribute indicates which potential input message in the pattern this specific input message will represent.

element = "stns:checkServiceStatus" />

The element attribute in the input element defines the message type for the input message, as the element was already defined in the types section.

Outfault

The outfault element defines possible output fault which could be sent back to the client if the operation fails.

<outfault messageLabel = "Out"

The messageLabel attribute of the outfault element defines which message will be replaced with the fault if there is a failure in the operation.

ref = "tns:dataFault" />

The ref attribute of the outfault element defines which fault (already defined in the interface element) will be referring.

Like us on Facebook