Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace WcfEchoService
- {
- // NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
- [ServiceContract]
- public interface IEchoService
- {
- [OperationContract, ProtoBehavior]
- string Echo(string value);
- [OperationContract, ProtoBehavior]
- string EchoNull();
- [OperationContract, ProtoBehavior]
- CompositeType[] EchoData(CompositeType[] value);
- }
- // Use a data contract as illustrated in the sample below to add composite types to service operations.
- [DataContract]
- [ProtoContract]
- public class CompositeType
- {
- [ProtoMember(1)]
- public bool BoolValue
- {
- get;
- set;
- }
- [ProtoMember(2)]
- public string StringValue
- {
- get;
- set;
- }
- }
- }
- #region IEchoService Members
- public EchoServiceClient() : base(new HttpBasicTransport("my service URI"))
- {
- }
- public string Echo(string value)
- {
- return (string)this.Invoke("Echo", value);
- }
- public string EchoNull()
- {
- return (string)this.Invoke("EchoNull");
- }
- public CompositeType[] EchoData(CompositeType[] value)
- {
- return (CompositeType[])this.Invoke("EchoData", value);
- }
- #endregion
- }
- class Program
- {
- static void Main(string[] args)
- {
- EchoServiceClient client = new EchoServiceClient();
- Console.WriteLine(client.EchoNull());
- }
- }
Add Comment
Please, Sign In to add comment