コード例 #1
0
ファイル: MessageContractCommon.cs プロジェクト: yukozh/wcf
        public static XmlDictionaryReader SetupMessageContractTests(bool isWrapped)
        {
            MyInspector      inspector = new MyInspector();
            BasicHttpBinding binding   = new BasicHttpBinding();
            ChannelFactory <IMessageContract> factory = new ChannelFactory <IMessageContract>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic));

            factory.Endpoint.EndpointBehaviors.Add(inspector);
            IMessageContract clientProxy = factory.CreateChannel();

            MessageContractTypes.RequestBankingData transaction = new MessageContractTypes.RequestBankingData();
            transaction.accountName     = MessageContractConstants.customerElementValue;
            transaction.transactionDate = DateTime.Now;
            MessageContractConstants.dateElementValue = transaction.transactionDate.TimeOfDay.ToString();
            transaction.amount = Convert.ToInt32(MessageContractConstants.transactionElementValue);

            if (isWrapped)
            {
                MessageContractTypes.ReplyBankingData responseData = clientProxy.MessageContractRequestReply(transaction);
            }
            else
            {
                MessageContractTypes.ReplyBankingDataNotWrapped responseData = clientProxy.MessageContractRequestReplyNotWrapped(transaction);
            }

            XmlDictionaryReader reader = inspector.ReceivedMessage.GetReaderAtBodyContents();

            return(reader);
        }
コード例 #2
0
ファイル: MessageContractCommon.cs プロジェクト: dmetzgar/wcf
        public static XmlDictionaryReader SetupMessageContractTests(bool isWrapped)
        {
            MyInspector inspector = new MyInspector();
            BasicHttpBinding binding = new BasicHttpBinding();
            ChannelFactory<IMessageContract> factory = new ChannelFactory<IMessageContract>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic));
            factory.Endpoint.EndpointBehaviors.Add(inspector);
            IMessageContract clientProxy = factory.CreateChannel();
            MessageContractTypes.RequestBankingData transaction = new MessageContractTypes.RequestBankingData();
            transaction.accountName = MessageContractConstants.customerElementValue;
            transaction.transactionDate = DateTime.Now;
            MessageContractConstants.dateElementValue = transaction.transactionDate.TimeOfDay.ToString();
            transaction.amount = Convert.ToInt32(MessageContractConstants.transactionElementValue);

            if (isWrapped)
            {
                MessageContractTypes.ReplyBankingData responseData = clientProxy.MessageContractRequestReply(transaction);
            }
            else
            {
                MessageContractTypes.ReplyBankingDataNotWrapped responseData = clientProxy.MessageContractRequestReplyNotWrapped(transaction);
            }

            XmlDictionaryReader reader = inspector.ReceivedMessage.GetReaderAtBodyContents();
            return reader;
        }
コード例 #3
0
        public static MyInspector SetupMessageContractTests(out IMessageContract clientProxy,
            out MessageContractTypes.RequestBankingData transaction)
        {
            MyInspector inspector = new MyInspector();
            BasicHttpBinding binding = new BasicHttpBinding();
            ChannelFactory<IMessageContract> factory = new ChannelFactory<IMessageContract>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic));
            factory.Endpoint.EndpointBehaviors.Add(inspector);
            clientProxy = factory.CreateChannel();
            transaction = new MessageContractTypes.RequestBankingData();
            transaction.accountName = MessageContractConstants.customerElementValue;
            transaction.transactionDate = DateTime.Now;
            MessageContractConstants.dateElementValue = transaction.transactionDate.TimeOfDay.ToString();
            transaction.amount = Convert.ToInt32(MessageContractConstants.transactionElementValue);

            return inspector;
        }
コード例 #4
0
        public static MyInspector SetupMessageContractTests(out IMessageContract clientProxy,
                                                            out MessageContractTypes.RequestBankingData transaction)
        {
            MyInspector      inspector = new MyInspector();
            BasicHttpBinding binding   = new BasicHttpBinding();
            ChannelFactory <IMessageContract> factory = new ChannelFactory <IMessageContract>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic));

            factory.Endpoint.EndpointBehaviors.Add(inspector);
            clientProxy                 = factory.CreateChannel();
            transaction                 = new MessageContractTypes.RequestBankingData();
            transaction.accountName     = MessageContractConstants.customerElementValue;
            transaction.transactionDate = DateTime.Now;
            MessageContractConstants.dateElementValue = transaction.transactionDate.TimeOfDay.ToString();
            transaction.amount = Convert.ToInt32(MessageContractConstants.transactionElementValue);

            return(inspector);
        }