Issue with soap-rpc:result

All,

I want to raise an issue with the model for RPC invocations and
responses defined in Section 5, Using SOAP for RPC, of SOAP 1.2 Part 2
[1].

Specifically, mandating the "result" element from the
"http://www.w3.org/2001/12/soap-rpc" namespace as the accessor for an
RPC call's return value is problematic because that element is defined
as being of anyType.

Here's an example that illustrates the problem. Assuming I am using RPC
without any message encoding (which I believe is legal because the RPC
model doesn't mandate an encoding style).

Given this function:

int Add(int n1, int n2)

I could define the request and response messages this way:

<xsd:complexType name="Add">
  <xsd:sequence>
    <xsd:element name="n1" type="xsd:int" />
    <xsd:element name="n2" type="xsd:int" />
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AddResponse">
  <xsd:sequence>
    <xsd:element name="result" type="xsd:int" />
  </xsd:sequence>
</xsd:complexType>

However, the RPC model mandates the use of the predefined and untyped
result element, which suggests a response message schema like this:

<xsd:complexType name="AddResponse">
  <xsd:sequence>
    <xsd:element ref="soap-rpc:result"
xmlns:soap-rpc="http://www.w3.org/2001/12/soap-rpc" />
  </xsd:sequence>
</xsd:complexType>

The problem is that this is an extremely loose contract, the result
element can contain *any* XML. It would be possible for a SOAP node
generating an instance of this response message type to use xsi:type to
indicate the content model for the result element at runtime. However,
the use of xsi:type is not mandatory and presenting type information
only at runtime does not help people generating code to process messages
at development time.

The heart of this problem is (at least as I see it) an inconsistency in
the spec:

"Each parameter accessor has a name corresponding to the name of the
parameter (see A Mapping Application Defined Name to XML Name) and type
corresponding to the type of the parameter."

"The name of the return value accessor is "result" and it is
namespace-qualified with the namespace identifier
"http://www.w3.org/2001/12/soap-rpc"."

Why are parameters strongly typed while the return value is not?

I'd like to see the spec rewritten this way:

"Each parameter accessor has a name corresponding to the name of the
parameter (see A Mapping Application Defined Name to XML Name) and type
corresponding to the type of the parameter. The name of the return value
accessor is "result" and has a type corresponding to the type of the
return value. The return value accessor MUST be present if the return
value of the procedure is non-void. The return value accessor MUST NOT
be present if the return value of the procedure is void."

Thanks,
Tim-

[1] http://www.w3.org/TR/2001/WD-soap12-part2-20011217/#soapforrpc

Received on Wednesday, 6 February 2002 10:18:05 UTC