Define the Schema Type
First, define the object’s type either in the WSDL file’s types element, or in an associated or embedded XML Schema. Here’s an excerpt from mime.wsdl in the MIME directory. This example illustrates both traditional attachments as specified by SwA, as well as unreferenced attachments as described by WS-I Attachments Profile 1.0.
<xsd:schema targetNamespace="
<!-- swaRef schema type, as defined in WS-I Attachments Profile 1.0 -->
<!-- -->
<xsd:simpleType name="swaRef">
<xsd:restriction base="xsd:anyURI"/>
<xsd:complexType name="DocumentPair">
<xsd:element name="DocumentName" type="xsd:string"/>
<xsd:element name="DocumentRef" type="tns:swaRef"/>
<xsd:complexType name="DocumentPairList">
<xsd:element name="List"
minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="Documents" type="tns:DocumentPairList"/>
Note the simple type swaRef. This a schema type defined by the WS-I Attachments Profile 1.0 that identifies any associated message attachment. The restriction xsd:anyURI references an attachment in the message. By using a common type, all recipients know that the referenced message is an attachment. (For more information, see This type is used in unreferenced attachments (see Generate Code and Manipulate the Attachment).
The WSDL defines two complex types, DocumentPair and DocumentPairList, which is simply a list of elements of type DocumentPair. DocumentPair contains two elements, DocumentName, the MIME document’s name, and DocumentRef, MIME document’s key. DocumentRef is of type swaRef, which identifies it as a link to an attachment. In addition, the element Documents is declared, of type DocumentPairList.