Beispiel #1
0
    public static void Main()
    {
        var b = new BasicHttpBinding();

        b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
        b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
        var cc = new ClientCredentials();

        cc.UserName.UserName = "******";
        IChannelFactory <IRequestChannel> cf = b.BuildChannelFactory <IRequestChannel> (cc);

        cf.Open();
        IRequestChannel req = cf.CreateChannel(
            new EndpointAddress("http://localhost:8080/"));

        Console.WriteLine(cf.GetProperty <ClientCredentials> ());
        req.Open();
        Message msg = Message.CreateMessage(MessageVersion.Soap11, "http://tempuri.org/IFoo/Echo", new EchoType("hoge"));

        //Message ret = req.Request (msg);
        IAsyncResult result = req.BeginRequest(msg, null, null);
        //return;
        Message ret = req.EndRequest(result);

        using (XmlWriter w = XmlWriter.Create(Console.Out)) {
            ret.WriteMessage(w);
        }
    }
Beispiel #2
0
        public T GetProperty <T>() where T : class
        {
            if (typeof(T) == typeof(IChannelFactory <TChannel>))
            {
                return((T)(object)this);
            }

            return(_innerChannelFactory.GetProperty <T>());
        }
Beispiel #3
0
        /// <summary>
        /// Gets a property
        /// </summary>
        /// <typeparam name="T">parameter</typeparam>
        /// <returns>property</returns>
        public override T GetProperty <T>()
        {
            T baseProperty = base.GetProperty <T>();

            if (baseProperty != null)
            {
                return(baseProperty);
            }
            return(_innerChannelFactory.GetProperty <T>());
        }
        public virtual IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingParameterCollection parameters)
        {
            this.EnsureInvariants();
            BindingContext             context = new BindingContext(new CustomBinding(this), parameters);
            IChannelFactory <TChannel> factory = context.BuildInnerChannelFactory <TChannel>();

            context.ValidateBindingElementsConsumed();
            this.ValidateSecurityCapabilities(factory.GetProperty <ISecurityCapabilities>(), parameters);
            return(factory);
        }
Beispiel #5
0
 public T GetProperty <T>() where T : class
 {
     if (_innerFactory != null)
     {
         return(_innerFactory.GetProperty <T>());
     }
     else
     {
         return(null);
     }
 }
            public override T GetProperty <T>()
            {
                if (typeof(T) == typeof(TypedServiceChannelFactory <TChannel>))
                {
                    return((T)(object)this);
                }

                T baseProperty = base.GetProperty <T>();

                if (baseProperty != null)
                {
                    return(baseProperty);
                }

                return(_innerChannelFactory.GetProperty <T>());
            }
        public virtual T GetProperty <T>() where T : class
        {
            IChannelFactory channelManager = this.channelManager as IChannelFactory;

            if (channelManager != null)
            {
                return(channelManager.GetProperty <T>());
            }
            IChannelListener listener = this.channelManager as IChannelListener;

            if (listener != null)
            {
                return(listener.GetProperty <T>());
            }
            return(default(T));
        }
        public virtual T GetProperty <T>() where T : class
        {
            IChannelFactory factory = this.channelManager as IChannelFactory;

            if (factory != null)
            {
                return(factory.GetProperty <T>());
            }

            IChannelListener listener = this.channelManager as IChannelListener;

            if (listener != null)
            {
                return(listener.GetProperty <T>());
            }

            return(null);
        }
 public override T GetProperty <T> ()
 {
     return(inner.GetProperty <T> ());
 }
Beispiel #10
0
 public override T GetProperty <T>()
 {
     return(innerChannelFactory.GetProperty <T>());
 }