I have an Operation Contract in my WCF service which returns an instance of the class which is actually a Message Contract. (Not Data Contract). The Message Contract has properties with attribute > [MessageBodyMember]
[MessageContract(WrapperName="AuthorizarionResponse", IsWrapped="true")]
public class AuthorizationResponse
{
[MessageBodyMember] public string role {get;set;};
[MessageBodyMember] public Organization organization {get; set;};
}
[ServiceContract]
interface IAuthorization
{
[OperationContract]
public AuthoriztionResponse GetAuthorizationResult(AuthorizationRequestMessage request);
}
Organization class uses the XmlSerializer. It does not use DataContract because I want WCF service to be used from existing ASMX clients.
When I debug the service and see the return value in the Operation Contract method, i can see everything which i want to return from the service through this operation contract.
But at the client side, I get null value!
Everything is ending without any exception/error. Fiddler2 does not give any red/error marks!
What would be going wrong?
The issue is Service sending the reply soap message not formed as expected by client Contract code. The serializer parses the Soap message based on Contract defined in Proxy code in client application, however, if the soap message received is not as expected, serializer Silently skips the content and moves forward. So, there is no error and also object is not filled because serializer didn’t find expected contents.
So, you’d need to identify how client expects soap message formed..