예제 #1
0
        public EchoMessageResponse EchoWithMessageContract(EchoMessageRequest request)
        {
            EchoMessageResponse echoMessageResponse = new EchoMessageResponse();

            echoMessageResponse.SayHello = "Saying Hello " + request.Text;
            echoMessageResponse.SayHi    = "Saying Hi " + request.Text;
            return(echoMessageResponse);
        }
예제 #2
0
        public static void AttributesForMessageContract()
        {
            System.ServiceModel.ChannelFactory <IServiceModelSimpleService> factory = DispatcherHelper.CreateChannelFactory <ServiceModelSimpleService, IServiceModelSimpleService>();
            factory.Open();
            IServiceModelSimpleService channel = factory.CreateChannel();

            ((System.ServiceModel.Channels.IChannel)channel).Open();
            EchoMessageResponse echo = channel.EchoWithMessageContract(new EchoMessageRequest()
            {
                Text = "Message Hello", APIKey = "DEVKEYTOTEST"
            });

            Assert.NotNull(echo);
            Assert.NotEmpty(echo.SayHello);
            Assert.NotEmpty(echo.SayHi);
            ((System.ServiceModel.Channels.IChannel)channel).Close();
            factory.Close();
            TestHelper.CloseServiceModelObjects((System.ServiceModel.Channels.IChannel)channel, factory);
        }