Russell Butek has an excellent article on the IBM web site about the various options for declaring SOAP services with WSDL. Though he goes through many of the combinations, I wanted a much shorter cheat sheet table.
There are 3 main factors, which give a total of 8 possible combinations (though in reality some are not valid).
- RPC vs. Document
- Encoded vs. Literal
- Unwrapped vs. Wrapped
This is the summary table I came up with (last row is the commonly used combination):
| State | Combo | Used | Note | ||
|---|---|---|---|---|---|
| 0: | RPC | Encoded | Unwrapped: | Seldom | Used with special data / graphs that need true references, and where a reference to an object can appear more than once. |
| 1: | RPC | Encoded | Wrapped: | Never | Wrapped implies Literal |
| 2: | RPC | Literal | Unwrapped: | Seldom | In the very rare case: Used if you have overloaded methods AND different methods with same args. Example: Have A(i), A(f,f) and B(f,f); two methods called A, and two methods with args (f,f). Maybe bad idea to overload anyway. |
| 3: | RPC | Literal | Wrapped: | Never | Although Wrapped implies Literal, in practice, Wrapped only used with Doc / Literal (wasteful w RPC / Literal) |
| 4: | Document | Encoded | Unwrapped: | Never | Nobody follows this style. It is not WS-I compliant. |
| 5: | Document | Encoded | Wrapped: | Never | Wrapped implies Literal |
| 6: | Document | Literal | Unwrapped: | Seldom | Used if you have overloaded methods (two methods with same name but different args). Maybe bad idea to overload anyway. |
| 7: | Document | Literal | Wrapped: | Loved by Microsoft and WS-I (disambiguation committee). Also gives a soap:body with one node, which also gives the name of the method. The tradeoff is a more complex wsdl | |
A really helpful article. I found the link to it from Jive's Clearspace Web Services Dev Guide.
Comments