Problem solve Get help with specific problems with your technologies, process and projects.

RPC vs. document type of orientations

What is the difference between RPC and document type of orientations in SOAP?

From a SOAP perspective, the distinction is whether or not you are using the SOAP RPC programming convention, as described in Section 7 of the SOAP 1.1 specification or Section 5 of the SOAP 1.2 Part 2 specification. This RPC programming convention is designed to allow SOAP to emulate an RPC call, i.e., to invoke a method using a method name and some set of parameters (0 or more), which returns a return value and some set of parameters (0 or more). From a wire perspective, a SOAP message body that's constructed using the RPC programming convention passes structures rather than individual elements. The request message (method invocation) is a modeled as a single struct, which contains an accessor for each [in] and/or [in/out] parameter. The name and type of the struct corresponds to the name and type of the method, and the name and type of each accessor corresponds to the name of each parameter. Likewise, the response message is modeled as a single struct containing an accessor for the return value (always the first accessor) and each of the [out] and/or [in/out] parameters. The name and type of each of the response accessors must match the name and type of the return parameters. When not using the RPC programming convention (usually referred to a SOAP Messaging), the message body may contain any number of elements. These elements normally conform to a schema of some sort, so a lot of folks characterize SOAP messaging by saying that you are passing "documents".

The terms "RPC-oriented" and "Document-oriented" are artifacts of the WSDL specification. To quote Section 3.4 of the WSDL 1.1 specification, "The style attribute [in the WSDL soap:operation element] indicates whether the operation is RPC-oriented (messages containing parameters and return values) or document-oriented (messages containing document(s)). This information may be used to select an aproriate programming model. The value of this attribute also affects the way in which the BODY of the SOAP message is constructed." [the message construction bit refers to the struct structure defined in the SOAP spec.] Keep in mind that if no value is specified, the default value is "document".

So -- this seems pretty straightforward. If you're invoking methods, you should be using the RPC programming convention, and you should describe your operations in WSDL as RPC-style. But it's not quite as simple as that. You can describe a SOAP message that uses the RPC programming convention as a document-style operation. And, in fact, Microsoft SOAP does so by default. This particular feature causes a fair amount of trouble when it comes to making .NET interoperate with other SOAP implementations. For easier interoperability, I'd recommend that you add the [SoapRpcService] directive to your applications to tell MS SOAP to define the service as RPC style, e.g.:

<%@ WebService Language="C#" Class="MSNetStockService" %>
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;


public class MSNetStockService {
   [WebMethod] ..

This was last published in February 2002

Dig Deeper on Service-oriented architecture (SOA)



Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.