Advantage Over Message Contracts

Posted by Mohankumarb under WCF on 3/1/2010 | Views : 3756 | Status : [Member] | Replies : 1
In WCF There are different Kind of Contracts , i have few questions on Message & Fault Contract
MessageContract :

1.If we Generate Message Contracts with modeling Edition there will be Request ,Response message Contracts for each operation
what if i have 30 operations in a single service there will be 60 message contracts & also data contracts in case needed, how this approach will be more advantage while taking coding factors maintainability, Reusing the Contracts ..etc
2.I would like to know what exactly the advantage of Message Contracts ,why Microsoft introduced them & Suggested to "Avoid message Contracts" , is there any extra benefit except code separation

Fault Contract :
A general way of Declaring FaultContract is
public interface ITestService
bool Test(string userId, string password);

throwing a faultException to the client is

ServiceFault fault = new ServiceFault();
throw new FaultException<MyServiceFault>(fault, new FaultReason(new FaultReasonText(
fault.ErrorMessage, CultureInfo.CurrentCulture)));

so with this client can able to catch MyServiceFault exception ,Done

1.My question is what is the advantage of writing [FaultContract] attribute still we can achieve this just by throwing fault exception

Message Size Limit :
1.during the communication between client & Server does message size (request/response) is matters ? how can we acheive this with DataContracts having suppose 10 properties but out of which am using only 1 or 2 rest will show in soap Message like this

<checkRequest xmlns="">
<token xmlns:b="" xmlns:i="">
<b:name2 i:nil="true"></b:name2>
<b:name3 i:nil="true"></b:name3>
it just having only 3 properties , what if having nested datacontracts & more properties which not assigned,
2.does message size having any impact if we try to remove soap xml elements having nil="true" & can we ? & How ?

Considering here some of the factors
1.Design of contracts made properly
2.LowBandWidth 50-100kbps

kindly help me


Posted by: Mohankumarb on: 3/1/2010 [Member] Starter

you can find some answers related to this here

Mohankumarb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response