Question

Microsoft MSDN describes the most universal service contract for a request reply operation as

[ServiceContract]
public interface IUniversalRequestReply
{
    [OperationContract(Action="*", ReplyAction="*")]
    Message ProcessMessage(Message msg);
}

If I make a contract like the one below, using basicHttp binding, it will not be WS-I compliant (using SOAPUI compliance check).

[OperationContract]
Message SomeOperation(Message msg);

I would think the most universal contract also would be the most interoperable.

Can anyone explain why it is not WS-I compliant? And more importantly - will using the Message class make the service less consumable to Java clients?

Any experience using the Message class is appreciated.

EDIT After first answer:

This is the full WSDL showing the service contract and operation contract.

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="UniversalRequestReply" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:52437/UniversalRequestReply.svc?xsd=xsd0" namespace="http://schemas.microsoft.com/Message"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IUniversalRequestReply_SomeOperation_InputMessage">
<wsdl:part xmlns:q1="http://schemas.microsoft.com/Message" name="msg" type="q1:MessageBody"/>
</wsdl:message>
<wsdl:message name="IUniversalRequestReply_SomeOperation_OutputMessage">
<wsdl:part xmlns:q2="http://schemas.microsoft.com/Message" name="SomeOperationResult" type="q2:MessageBody"/>
</wsdl:message>
<wsdl:portType name="IUniversalRequestReply">
<wsdl:operation name="SomeOperation">
<wsdl:input wsaw:Action="http://tempuri.org/IUniversalRequestReply/SomeOperation" message="tns:IUniversalRequestReply_SomeOperation_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IUniversalRequestReply/SomeOperationResponse" message="tns:IUniversalRequestReply_SomeOperation_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IUniversalRequestReply" type="tns:IUniversalRequestReply">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SomeOperation">
<soap:operation soapAction="http://tempuri.org/IUniversalRequestReply/SomeOperation" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UniversalRequestReply">
<wsdl:port name="BasicHttpBinding_IUniversalRequestReply" binding="tns:BasicHttpBinding_IUniversalRequestReply">
<soap:address location="http://localhost:52437/UniversalRequestReply.svc/basic"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

What the WSI Compliance test fails is not a missing service contract, but the Message input itself:

Name of message that failed: {http://tempuri.org/}IUniversalRequestReply_SomeOperation_InputMessage
Message: name={http://tempuri.org/}IUniversalRequestReply_SomeOperation_InputMessage
Part: name=msg
typeName={http://schemas.microsoft.com/Message}MessageBody

So using this Message class is not WS-I compliant of some reason.

Was it helpful?

Solution

The reason is the service is not complaint is because it does not define any service contract. Universal means this service can consume the soap message generated by any client that calls it. It does not attempt to deserialize the soap message because it never defines a contract of its own. WS-I compliance requires that a service define a static contract that can be expressed in WSDL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top