Hi!
I know this question is been asked before here but still I'm not sure what to select.
My service will be called from many 3 party system in the enterprise. I'm almost sure the information the service will collect (MyBigClassWithAllInfo) will change during the products lifetime. Is it still a good idea to expose objects?
This is basically what my two alternatives:
[ServiceContract] public interface ICollectStuffService { [OperationContract] SetDataResponseMsg SetData(SetDataRequestMsg dataRequestMsg); } // Alternative 1: Put all data inside a xml file [DataContract] public class SetDataRequestMsg { [DataMember] public string Body { get; set; } [DataMember] public string OtherPropertiesThatMightBeHandy { get; set; } // ?? } // Alternative 2: Expose the objects [DataContract] public class SetDataRequestMsg { [DataMember] public Header Header { get; set; } [DataMember] public MyBigClassWithAllInfo ExposedObject { get; set; } } public class SetDataResponseMsg { [DataMember] public ServiceError Error { get; set; } }
The xml file would look like this:
<?xml version="1.0" encoding="utf-8"?> <Message> <Header> <InfoAboutTheSender>...</InfoAboutTheSender> </Header> <StuffToCollectWithAllTheInfo> <stuff1>...</stuff1> </StuffToCollectWithAllTheInfo> </Message>
Any thought on how this service should be implemented?
Thanks Larsi