Tuesday, September 30, 2008

Web-Services best practices

Following are different types of the WSDL

1. RPC

2. Document

RPC can be of two types

1. RPC encoded
2. RPC literal

Document style can be of two types

1. Document Literal
2. Document Literal Wrapped





The "wrapped" convention produces document/literal services, and yet it supports an RPC-style programming interface (i.e., it performs automatic marshalling of input parameters and return values).The rules for the "wrapped" convention are fairly simple:

  1. "Wrapped" is a form of document/literal, therefore it must follow all the rules defined for document/literal. When defining a document/literal service, there can be at most one body part in your input message and at most one body part in your output message. You do *not* define each method parameter as a separate part in the message definition. (The parameters are defined in the types section, instead.)

  2. Each part definition must reference an element (not a type) defined, imported, or included in the types section of the WSDL document. These element definitions are "wrapper" elements (hence the name of this convention). You define your input and output parameters as element structures within these wrapper elements.
  3. A wrapper element must be defined as a complex type that is a sequence of elements. Each child element in that sequence will be generated as a parameter in the service interface.
    The name of the input wrapper element must be the same as the operation name.
    The name of the output wrapper element should be (but doesn't have to be) the operation name appended with "Response" (e.g., if the operation name is "add", the output wrapper element should be called "addResponse").
  4. In the binding definition, the soap:binding should specify style="document" (although this is the default value, so the attribute may be omitted), and the soap:body definitions must specify use="literal" and nothing else. You must not specify the namespace or encodingStyle attributes in the soap:body definition.

No comments: