tags:

views:

250

answers:

1

I have a web service , i add some extra class which have message contract and after that it changed the way we access some of the methods( and i have not added message contract to these classes these are data contracts ), earlier i.e before we could create one object for request and response (like see the Before part) we are creating a single object for OrderStatusResponse Class. But if you see now the After(we have to create separate objects for request and response).

is this a side effect of enabling "Always generate message contract?"

Before

SmartConnect.Service1Client Client = 
    new SmartConnectClient.SmartConnect.Service1Client();
SmartConnect.OrderStatusResponse Status = 
    new SmartConnectClient.SmartConnect.OrderStatusResponse();
Status.UserID = "1234";
Status.Password = "abcd";
Status.SoftwareKey = "abc";
Status.OrderNumber = "1234";

Status = Client.GetOrderStatus(Status);
lbl_OS.Text = Status.Status.ToString();
lbl_RM.Text = Status.ReturnMessage.ToString();

After

SmartConnectRepublic.SmartConnectClient SmartClient = 
    new WCF_Client.SmartConnectRepublic.SmartConnectClient();
//SmartConnectRepublic.OrderStatusResponse Status = 
    new WCF_Client.SmartConnectRepublic.OrderStatusResponse();

WCF_Client.SmartConnectRepublic.GetOrderStatusRequest request = 
    new WCF_Client.SmartConnectRepublic.GetOrderStatusRequest();


request.status = new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
request.status.OrderNumber = "1055055";
request.status.UserID = "1234";
request.status.Password = "dfsdfsd";
request.status.SoftwareKey = "sdfsdfsdfs";

WCF_Client.SmartConnectRepublic.GetOrderStatusResponse response = 
    new WCF_Client.SmartConnectRepublic.GetOrderStatusResponse();

response = SmartClient.GetOrderStatus(request);


lbl_Status.Text =  response.GetOrderStatusResult.Status;
lbl_RC.Text = response.GetOrderStatusResult.ReturnCode.ToString();
lbl_RM.Text = response.GetOrderStatusResult.ReturnCode.ToString();
A: 

Yes, I suspect it is a difference with using message contracts. You seem to have figured it out, though.

John Saunders
it there some way i can avoid this? I mean any configuration changes???
Pinu
Yes. Don't use message contracts.
John Saunders
but I need to stream files in some of my methods and message contract fits in best with streaming large files in WCF
Pinu
I think you should see "Large Data and Streaming" at http://msdn.microsoft.com/en-us/library/ms733742.aspx
John Saunders