Though there are various ways to design a service and since webservices are XML based and XML is tagged as platform independent, different programming languages and different application server have their own set of rules while defining a web service. WSI-Basic Profile helps address some interoperability issues that might arise because of the proprietary nature of majority of tools and languages. Listed out below are some of the guidelines that can be useful while defining a service:
XML version is 1.0
Encoding must be UTF-8 or UTF-16
Namespace for WSDL is defined as http://schemas.xmlsoap.org/wsdl/?
Namespace for SOAP binding is defined as http://schemas.xmlsoap.org/wsdl/soap/
Namespace for SOAP encoding is defined as http://schemas.xmlsoap.org/soap/encoding/
Namespace should not be as http://www.w3.org/XML/1998/namespace
Custom Data types used in WSDL should conform to XML Schema version 1.0
Data Type that causes interoperability issues should not be used. For ex. wsdl:arrayType, arrayOfStrings etc. should not be used.
All the xsd:import elements should be used within the xsd:schema element of the types section
The attribute wsdl:required=”true” should not be used by any element.
wsdl:import URIs should be absolute and not relative.
wsdl:import should precede all other wsdl types , except wsdl:documentation. Similarly, wsdl:types should precede all other elements, except wsdl:documentation and wsdl:import
targetNamespace value of WSDL that is being imported should have the same value as wsdl:import.
All the imported schemas should have a root element defined with namespace http://www.w3.org/2001/XMLSchema
Part attribute, if any, in a document literal style of web service should be defined within binding or operation.
In Document Literal style, wsdl:part elements that are used in soapbind:body should have ‘element’ attribute defined.
In a wsdl:message/wsdl:part element, the ‘element’ attribute should refer to a global element declaration and not to any xsd types.
In an RPC Literal style, envelope should not have xsi:nil attribute value = “1” or “true”.
In an RPC Literal style, wsdl:part elements that are used in soapbind:body should have ‘type’ attribute defined.
In a wsdl:portType definition, Solicit-Response/Notification type operations should not be used.
A wsdl:message element should not have both type and element attributes defined.
The values for name attribute of wsdl:portType elements should be distinct.
In soap:binding element, the transport attribute should be defined and the value should be http://schemas.xmlsoap.org/soap/http.
In a soap:operation, the value of style attribute should be either “rpc” or “document”.
In a soap:operation, the soap:bodyelement should have use attribute set to “literal” ?
If soap:header/soap:headerfault/soap:fault elements are defined, the use attribute should be set to “literal”
The location attribute should have distinct value for different ports wsdl:port.
A soap:fault should be defined for each fault defined and it should contain name attribute. If use attribute is defined, it should contain a value ‘literal’
Similarly, a soap:headerfault should exist for each header fault defined.
If SOAP Action is defined within operation, it should be set in the HTTP header of the request otherwise, it should be set to empty quoted string.
|SOAP envelope should contain namespace http://schemas.xml.soap.org/soap/envelope whereas SOAP encoding namespace should be http://schemas.xmlsoap.org/soap/encoding/A SOAP message should also use UTF-8 or UTF-16 encoding.
Intermediaries, if present while transmitting SOAP message, should modify the header only if the must-understand attribute is set to true. Intermediaries should not modify the payload or elements with the SOAP Body.
A must understand faultcode must be generated in case receiver is unable to process the mandatory header of the SOAP message.
In case of a fault, soap:Fault must not have childrens other than faultcode, faultstring, faultactor and detail. In case of fault, children of the soap:Fault element must be unqualified. There can be zero or more child elements of the detail element, which can be either qualified or unqualified.
Values of the faultcode element are defined by SOAP specification and preferably should not be modified.