diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2009-08-18 18:24:10 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2009-08-18 18:24:10 +0400 |
commit | ee08a4d041bdb88f49a027ce1a4f7736751a32d5 (patch) | |
tree | ffff591ad222a2c32280e9c67ff92c0a22d5d63c | |
parent | 1163a482f7430930bee670cf4c6721ecf9880974 (diff) |
In System.ServiceModel.Description:moon/1.99.1.1
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* DataContractSerializerOperationBehavior.cs : add missing members.
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* MetadataExchangeClient.cs : add missing async methods.
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* MetadataResolver.cs : added remaining methods.
* MetadataExchangeClient.cs : a bit of required changes for above.
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* ServiceDebugBehavior.cs, ServiceMetadataBehavior.cs :
add Binding properties. Properties are now auto.
* ServiceMetadataExtension.cs : take Binding too to build dispatcher.
In System.ServiceModel.Channels:
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* ReplyChannelBase.cs, DuplexChannelBase.cs, RequestChannelBase.cs:
implement GetProperty<T>() and return its channel manager.
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* PeerDuplexChannel.cs : ongoing implementation. Fix wrong peer
destination address in Connect() request. To repeat sending
request, use buffered copy. Set some peer-channel specific
header items. (todo: and consume them.)
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* Message.cs : state is set only after WriteBodyContents().
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* MessageHeaders.cs : eliminate wrong use of
ReadElementContentAsString() (it is not always simple string).
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* MessageHeaders.cs : when the value is null, do not try to
deserialize EndpointAddress.
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* MessageHeader.cs : add Value property. (Forgot dependent change.)
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* MessageHeaders.cs : GetHeader<T>() could mostly skip extra
serialization and deserialization of values.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* PeerDuplexChannel.cs : handle Welcome and Refuse at client side.
Now simply use connector contract.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* PeerDuplexChannel.cs : handle Disconnect(). Fix URLs a bit.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* TcpChannelListener.cs : do not try to compare dead connection's
IPEndPoint (it raises an error).
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* MessageHeaders.cs : allow null header value on each specific setter.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* DuplexChannelBase.cs, TcpDuplexSessionChannel.cs :
get local and remote address of connected counterpart to get
callback channel connected.
* PeerDuplexChannel.cs : remove FIXME wrt above.
In System.ServiceModel:
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* ServiceHostBase.cs : wildcard action support was not working
for one-way channels.
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* ServiceHostBase.cs : set expected AddressFilter.
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* EndpointAddress.cs : #if !NET_2_1 is removing code too much.
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* ServiceRuntimeChannel.cs : made some properties in duplex context
channel dispatching to internal client.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* OperationContextScope.cs : check null arg.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* ServiceRuntimeChannel.cs : return timeouts that are set at
dispatch runtime later than its .ctor(). Provide ListenUri too.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* AllEnums.cs : add AddressFilterMode and SupportedAddressingMode.
* ServiceBehaviorAttribute.cs : added missing properties.
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* ClientBase.cs : (ChannelBase) now ClientRuntimeChannel demands an
explicit address.
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* ServiceHostBase.cs : use new IOperationInvoker implementation.
In .:
2009-08-18 Sebastien Pouliot <sebastien@ximian.com>
Update everything to r140102 which is known to work properly
on robozzle and ITV.
[Fix bug 531893]
r: kangaroo
2009-08-11 Astushi Enomoto <atsushi@ximian.com>
* System.ServiceModel.dll.sources: add DefaultOperationInvoker.cs.
In System.ServiceModel.Dispatcher:
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* EndpointDispatcher.cs : do not try to create wrong filter.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* ChannelDispatcher.cs : EndpointNotFoundException message could
be a bit kindful.
2009-08-11 Atsushi Enomoto <atsushi@ximian.com>
* IOperationInvoker.cs : fix interface.
* DefaultOperationInvoker.cs : refresh implementation of the above.
* BaseMessagesFormatter.cs, OperationInvokerHandler.cs :
dependent changes for above.
In System.ServiceModel.PeerResolvers:
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* IPeerConnectorContract.cs : use wildcard for the actual message
transfer operation.
2009-08-17 Atsushi Enomoto <atsushi@ximian.com>
* IPeerConnectorContract.cs : fix internal member name to get
serialized correctly.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* IPeerConnectorContract.cs : add itself as CallbackContract.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* IPeerConnectorContract.cs : remove receiver contract.
2009-08-14 Atsushi Enomoto <atsushi@ximian.com>
* IPeerConnectorContract.cs : add Disconnect() to receiver contract.
svn path=/branches/moon/1.99.1/mcs/; revision=140164
36 files changed, 680 insertions, 208 deletions
diff --git a/mcs/class/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/ChangeLog index 324ec5828fc..d31cceb6fcd 100755 --- a/mcs/class/System.ServiceModel/ChangeLog +++ b/mcs/class/System.ServiceModel/ChangeLog @@ -1,3 +1,15 @@ +2009-08-18 Sebastien Pouliot <sebastien@ximian.com> + + Update everything to r140102 which is known to work properly + on robozzle and ITV. + [Fix bug 531893] + + r: kangaroo + +2009-08-11 Astushi Enomoto <atsushi@ximian.com> + + * System.ServiceModel.dll.sources: add DefaultOperationInvoker.cs. + 2009-08-07 Astushi Enomoto <atsushi@ximian.com> * System.ServiceModel.dll.sources: add ServiceProxyGenerator.cs. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog index 14baa1af374..c77856f29d6 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog @@ -1,3 +1,63 @@ +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * ReplyChannelBase.cs, DuplexChannelBase.cs, RequestChannelBase.cs: + implement GetProperty<T>() and return its channel manager. + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * PeerDuplexChannel.cs : ongoing implementation. Fix wrong peer + destination address in Connect() request. To repeat sending + request, use buffered copy. Set some peer-channel specific + header items. (todo: and consume them.) + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * Message.cs : state is set only after WriteBodyContents(). + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * MessageHeaders.cs : eliminate wrong use of + ReadElementContentAsString() (it is not always simple string). + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * MessageHeaders.cs : when the value is null, do not try to + deserialize EndpointAddress. + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * MessageHeader.cs : add Value property. (Forgot dependent change.) + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * MessageHeaders.cs : GetHeader<T>() could mostly skip extra + serialization and deserialization of values. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * PeerDuplexChannel.cs : handle Welcome and Refuse at client side. + Now simply use connector contract. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * PeerDuplexChannel.cs : handle Disconnect(). Fix URLs a bit. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * TcpChannelListener.cs : do not try to compare dead connection's + IPEndPoint (it raises an error). + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * MessageHeaders.cs : allow null header value on each specific setter. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * DuplexChannelBase.cs, TcpDuplexSessionChannel.cs : + get local and remote address of connected counterpart to get + callback channel connected. + * PeerDuplexChannel.cs : remove FIXME wrt above. + 2009-08-07 Atsushi Enomoto <atsushi@ximian.com> * PeerDuplexChannel.cs : add fixme comment and remove extra FIXME. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs index 4ef412f886f..75149f816f4 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/DuplexChannelBase.cs @@ -36,15 +36,15 @@ namespace System.ServiceModel.Channels { internal abstract class DuplexChannelBase : ChannelBase, IDuplexChannel { - //ChannelFactoryBase channel_factory_base; - //ChannelListenerBase channel_listener_base; + ChannelFactoryBase channel_factory_base; + ChannelListenerBase channel_listener_base; EndpointAddress local_address; EndpointAddress remote_address; Uri via; public DuplexChannelBase (ChannelFactoryBase factory, EndpointAddress remoteAddress, Uri via) : base (factory) { - //channel_factory_base = factory; + channel_factory_base = factory; remote_address = remoteAddress; this.via = via; SetupDelegates (); @@ -52,16 +52,16 @@ namespace System.ServiceModel.Channels public DuplexChannelBase (ChannelListenerBase listener) : base (listener) { - //channel_listener_base = listener; + channel_listener_base = listener; local_address = new EndpointAddress (listener.Uri); SetupDelegates (); } - public EndpointAddress LocalAddress { + public virtual EndpointAddress LocalAddress { get { return local_address; } } - public EndpointAddress RemoteAddress { + public virtual EndpointAddress RemoteAddress { get { return remote_address; } } @@ -79,6 +79,15 @@ namespace System.ServiceModel.Channels try_receive_handler = new TryReceiveHandler (TryReceive); } + public override T GetProperty<T> () + { + if (typeof (T) == typeof (IChannelFactory)) + return (T) (object) channel_factory_base; + if (typeof (T) == typeof (IChannelListener)) + return (T) (object) channel_listener_base; + return base.GetProperty<T> (); + } + // Open Action<TimeSpan> open_handler; diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs index 560477221d6..542ea700401 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs @@ -162,13 +162,13 @@ namespace System.ServiceModel.Channels OnWriteBodyContents (writer); else if (Version.Envelope == EnvelopeVersion.None) WriteXsiNil (writer); + State = MessageState.Written; } public void WriteMessage (XmlDictionaryWriter writer) { if (State != MessageState.Created) throw new InvalidOperationException (String.Format ("The message is already at {0} state", State)); - State = MessageState.Written; OnWriteMessage (writer); } @@ -180,9 +180,8 @@ namespace System.ServiceModel.Channels public void WriteStartBody (XmlDictionaryWriter writer) { - if (State != MessageState.Created && State != MessageState.Written) + if (State != MessageState.Created) throw new InvalidOperationException (String.Format ("The message is already at {0} state", State)); - State = MessageState.Written; OnWriteStartBody (writer); } @@ -195,9 +194,8 @@ namespace System.ServiceModel.Channels public void WriteStartEnvelope (XmlDictionaryWriter writer) { - if (State != MessageState.Created && State != MessageState.Written) + if (State != MessageState.Created) throw new InvalidOperationException (String.Format ("The message is already at {0} state", State)); - State = MessageState.Written; OnWriteStartEnvelope (writer); } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs index 89f7948fcf4..e13a27feb70 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs @@ -287,6 +287,8 @@ namespace System.ServiceModel.Channels this.formatter.WriteObjectContent (writer, value); } + public object Value { get { return value; } } + public override string Actor { get { return actor; }} public override bool IsReferenceParameter { get { return is_ref; }} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs index 34dde7b58c1..cd00eff07f1 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs @@ -157,9 +157,14 @@ namespace System.ServiceModel.Channels public T GetHeader<T> (int index) { + if (l.Count <= index) + throw new ArgumentOutOfRangeException ("index"); + var dmh = l [index] as MessageHeader.DefaultMessageHeader; + if (dmh != null && dmh.Value != null && typeof (T).IsAssignableFrom (dmh.Value.GetType ())) + return (T) dmh.Value; if (typeof (T) == typeof (EndpointAddress)) { XmlDictionaryReader r = GetReaderAtHeader (index); - return (T) (object) new EndpointAddress (r.ReadElementContentAsString ()); + return r.NodeType != XmlNodeType.Element ? default (T) : (T) (object) EndpointAddress.ReadFrom (r); } else return GetHeader<T> (index, GetSerializer<T> (index)); @@ -318,7 +323,8 @@ namespace System.ServiceModel.Channels } set { RemoveAll ("Action", version.Addressing.Namespace); - Add (MessageHeader.CreateHeader ("Action", version.Addressing.Namespace, value, true)); + if (value != null) + Add (MessageHeader.CreateHeader ("Action", version.Addressing.Namespace, value, true)); } } @@ -337,10 +343,8 @@ namespace System.ServiceModel.Channels throw new InvalidOperationException ("WS-Addressing header is not allowed for AddressingVersion.None"); RemoveAll ("FaultTo", Constants.WSA1); - Add (MessageHeader.CreateHeader ( - "FaultTo", - Constants.WSA1, - EndpointAddress10.FromEndpointAddress (value))); + if (value != null) + Add (MessageHeader.CreateHeader ("FaultTo", Constants.WSA1, EndpointAddress10.FromEndpointAddress (value))); } } @@ -354,10 +358,8 @@ namespace System.ServiceModel.Channels throw new InvalidOperationException ("WS-Addressing header is not allowed for AddressingVersion.None"); RemoveAll ("From", Constants.WSA1); - Add (MessageHeader.CreateHeader ( - "From", - Constants.WSA1, - EndpointAddress10.FromEndpointAddress (value))); + if (value != null) + Add (MessageHeader.CreateHeader ("From", Constants.WSA1, EndpointAddress10.FromEndpointAddress (value))); } } #endif @@ -376,10 +378,8 @@ namespace System.ServiceModel.Channels throw new InvalidOperationException ("WS-Addressing header is not allowed for AddressingVersion.None"); RemoveAll ("MessageID", Constants.WSA1); - Add (MessageHeader.CreateHeader ( - "MessageID", - Constants.WSA1, - value.ToString ())); + if (value != null) + Add (MessageHeader.CreateHeader ("MessageID", Constants.WSA1, value.ToString ())); } } @@ -395,10 +395,8 @@ namespace System.ServiceModel.Channels throw new InvalidOperationException ("WS-Addressing header is not allowed for AddressingVersion.None"); RemoveAll ("MessageID", Constants.WSA1); - Add (MessageHeader.CreateHeader ( - "RelatesTo", - Constants.WSA1, - value.ToString ())); + if (value != null) + Add (MessageHeader.CreateHeader ("RelatesTo", Constants.WSA1, value.ToString ())); } } @@ -414,10 +412,8 @@ namespace System.ServiceModel.Channels throw new InvalidOperationException ("WS-Addressing header is not allowed for AddressingVersion.None"); RemoveAll ("ReplyTo", Constants.WSA1); - Add (MessageHeader.CreateHeader ( - "ReplyTo", - Constants.WSA1, - EndpointAddress10.FromEndpointAddress (value))); + if (value != null) + Add (MessageHeader.CreateHeader ("ReplyTo", Constants.WSA1, EndpointAddress10.FromEndpointAddress (value))); } } #endif @@ -430,11 +426,8 @@ namespace System.ServiceModel.Channels } set { RemoveAll ("To", version.Addressing.Namespace); - Add (MessageHeader.CreateHeader ( - "To", - version.Addressing.Namespace, - value.AbsoluteUri, - true)); + if (value != null) + Add (MessageHeader.CreateHeader ("To", version.Addressing.Namespace, value.AbsoluteUri, true)); } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs index 9e47007b27a..0697e262fbb 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs @@ -37,6 +37,7 @@ using System.ServiceModel.Description; using System.ServiceModel.PeerResolvers; using System.ServiceModel.Security; using System.Threading; +using System.Xml; namespace System.ServiceModel.Channels { @@ -69,7 +70,7 @@ namespace System.ServiceModel.Channels public IPeerConnectorClient Channel { get; set; } } - class LocalPeerReceiver : IPeerReceiverContract + class LocalPeerReceiver : IPeerConnectorContract { public LocalPeerReceiver (PeerDuplexChannel owner) { @@ -82,27 +83,38 @@ namespace System.ServiceModel.Channels { if (connect == null) throw new ArgumentNullException ("connect"); -try { var ch = OperationContext.Current.GetCallbackChannel<IPeerConnectorContract> (); -// FIXME: so, this duplex channel, when created by a listener, lacks RemoteAddress to send callback. Get it from somewhere. -Console.WriteLine ("FIXME FIXME:" + ((IContextChannel) ch).RemoteAddress); + // FIXME: wrong destination // FIXME: check and reject if inappropriate. ch.Welcome (new WelcomeInfo () { NodeId = connect.NodeId }); + } -} catch (Exception ex) { -Console.WriteLine ("Exception during Connect()"); -Console.WriteLine (ex); -throw; -} - + public void Disconnect (DisconnectInfo disconnect) + { + if (disconnect == null) + throw new ArgumentNullException ("disconnect"); + // Console.WriteLine ("DisconnectInfo.Reason: " + disconnect.Reason); + // FIXME: handle disconnection in practice. So far I see nothing to do. } public void Welcome (WelcomeInfo welcome) { + owner.HandleWelcomeResponse (welcome); } public void Refuse (RefuseInfo refuse) { + owner.HandleRefuseResponse (refuse); + } + + public void LinkUtility (LinkUtilityInfo linkUtility) + { + throw new NotImplementedException (); + } + + public void Ping () + { + throw new NotImplementedException (); } public void SendMessage (Message msg) @@ -123,6 +135,7 @@ throw; ServiceHost listener_host; TcpChannelInfo info; List<RemotePeerConnection> peers = new List<RemotePeerConnection> (); + PeerNodeAddress local_node_address; public PeerDuplexChannel (IPeerChannelManager factory, EndpointAddress address, Uri via, PeerResolver resolver) : base ((ChannelFactoryBase) factory, address, via) @@ -164,28 +177,62 @@ throw; channel_factory = new ChannelFactory<IPeerConnectorClient> (binding); } - return channel_factory.CreateChannel (new EndpointAddress ("net.p2p://" + node.MeshId), pna.EndpointAddress.Uri); + return channel_factory.CreateChannel (new EndpointAddress ("net.p2p://" + node.MeshId + "/"), pna.EndpointAddress.Uri); } + public void HandleWelcomeResponse (WelcomeInfo welcome) + { + last_connect_response = welcome; + connect_handle.Set (); + } + + public void HandleRefuseResponse (RefuseInfo refuse) + { + last_connect_response = refuse; + connect_handle.Set (); + } + + AutoResetEvent connect_handle = new AutoResetEvent (false); + object last_connect_response; + public override void Send (Message message, TimeSpan timeout) { ThrowIfDisposedOrNotOpen (); DateTime start = DateTime.Now; - + + // FIXME: give max buffer size + var mb = message.CreateBufferedCopy (0x10000); + foreach (var pc in peers) { + message = mb.CreateMessage (); + if (pc.Status == RemotePeerStatus.None) { + pc.Status = RemotePeerStatus.Error; // prepare for cases that it resulted in an error in the middle. var inner = CreateInnerClient (pc.Address); pc.Channel = inner; inner.Open (timeout - (DateTime.Now - start)); inner.OperationTimeout = timeout - (DateTime.Now - start); - inner.Connect (new ConnectInfo () { PeerNodeAddress = pc.Address, NodeId = (uint) node.NodeId }); + inner.Connect (new ConnectInfo () { Address = local_node_address, NodeId = (uint) node.NodeId }); // FIXME: wait for Welcome or Reject and take further action. - throw new NotImplementedException (); +/* +Console.WriteLine ("WAITING FOR Welcome or Refuse"); + if (!connect_handle.WaitOne (timeout - (DateTime.Now - start))) + throw new TimeoutException (); +Console.WriteLine ("got signaled"); + if (last_connect_response is RefuseInfo) + throw new CommunicationException ("Peer neighbor connection was refused"); +*/ + pc.Status = RemotePeerStatus.Connected; } pc.Channel.OperationTimeout = timeout - (DateTime.Now - start); + + if (message.Headers.MessageId == null) + message.Headers.MessageId = new UniqueId (); + message.Headers.Add (MessageHeader.CreateHeader ("PeerTo", String.Empty, RemoteAddress)); + message.Headers.Add (MessageHeader.CreateHeader ("PeerVia", String.Empty, RemoteAddress)); pc.Channel.SendMessage (message); } } @@ -283,13 +330,14 @@ message = mb.CreateMessage (); sba.InstanceContextMode = InstanceContextMode.Single; sba.IncludeExceptionDetailInFaults = true; - var se = listener_host.AddServiceEndpoint (typeof (IPeerReceiverContract), binding, "net.p2p://" + node.MeshId); + var se = listener_host.AddServiceEndpoint (typeof (IPeerConnectorContract).FullName, binding, "net.p2p://" + node.MeshId + "/"); se.ListenUri = uri; listener_host.Open (timeout - (DateTime.Now - start)); var nid = new Random ().Next (0, int.MaxValue); var ea = new EndpointAddress (uri); var pna = new PeerNodeAddress (ea, new ReadOnlyCollection<IPAddress> (Dns.GetHostEntry (name).AddressList)); + local_node_address = pna; node.RegisteredId = resolver.Register (node.MeshId, pna, timeout - (DateTime.Now - start)); node.NodeId = nid; diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs index 6c2c81db3d6..135adc9a3cb 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs @@ -59,8 +59,17 @@ namespace System.ServiceModel.Channels { } + ChannelListenerBase listener; + public abstract EndpointAddress LocalAddress { get; } + public override T GetProperty<T> () + { + if (typeof (T) == typeof (IChannelListener)) + return (T) (object) listener; + return base.GetProperty<T> (); + } + protected override void OnAbort () { OnClose (TimeSpan.Zero); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/RequestChannelBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/RequestChannelBase.cs index 392ea2d6bc3..ee29936c58b 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/RequestChannelBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/RequestChannelBase.cs @@ -66,6 +66,13 @@ namespace System.ServiceModel.Channels get { return via ?? RemoteAddress.Uri; } } + public override T GetProperty<T> () + { + if (typeof (T) == typeof (IChannelFactory)) + return (T) (object) channel_factory; + return base.GetProperty<T> (); + } + // Request public Message Request (Message message) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpChannelListener.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpChannelListener.cs index 6940eeb7f9d..54b8bc5d4d7 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpChannelListener.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpChannelListener.cs @@ -111,7 +111,7 @@ namespace System.ServiceModel.Channels if (client != null) { foreach (var ch in accepted_channels) { var dch = ch as TcpDuplexSessionChannel; - if (dch == null || dch.TcpClient == null) + if (dch == null || dch.TcpClient == null && !dch.TcpClient.Connected) continue; if (((IPEndPoint) dch.TcpClient.Client.RemoteEndPoint).Equals (client.Client.RemoteEndPoint)) // ... then it should be handled in another BeginTryReceive/EndTryReceive loop in ChannelDispatcher. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs index 0d712191604..4f294b9358f 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpDuplexSessionChannel.cs @@ -69,6 +69,7 @@ namespace System.ServiceModel.Channels bool is_service_side; TcpBinaryFrameManager frame; TcpDuplexSession session; // do not use this directly. Use Session instead. + EndpointAddress counterpart_address; public TcpDuplexSessionChannel (ChannelFactoryBase factory, TcpChannelInfo info, EndpointAddress address, Uri via) : base (factory, address, via) @@ -79,6 +80,7 @@ namespace System.ServiceModel.Channels // make sure to acquire TcpClient here. int explicitPort = Via.Port; client = new TcpClient (Via.Host, explicitPort <= 0 ? TcpTransportBindingElement.DefaultPort : explicitPort); + counterpart_address = GetEndpointAddressFromTcpClient (client); } public TcpDuplexSessionChannel (ChannelListenerBase listener, TcpChannelInfo info, TcpClient client) @@ -87,12 +89,27 @@ namespace System.ServiceModel.Channels is_service_side = true; this.client = client; this.info = info; + counterpart_address = GetEndpointAddressFromTcpClient (client); } - + + EndpointAddress GetEndpointAddressFromTcpClient (TcpClient client) + { + IPEndPoint ep = (IPEndPoint) client.Client.RemoteEndPoint; + return new EndpointAddress (new Uri ("net.tcp://" + ep)); + } + public MessageEncoder Encoder { get { return info.MessageEncoder; } } + public override EndpointAddress RemoteAddress { + get { return base.RemoteAddress ?? counterpart_address; } + } + + public override EndpointAddress LocalAddress { + get { return base.LocalAddress ?? counterpart_address; } + } + public IDuplexSession Session { get { if (session == null) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog index 5a62f91c599..1b6c520986f 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog @@ -1,3 +1,22 @@ +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * DataContractSerializerOperationBehavior.cs : add missing members. + +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * MetadataExchangeClient.cs : add missing async methods. + +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * MetadataResolver.cs : added remaining methods. + * MetadataExchangeClient.cs : a bit of required changes for above. + +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceDebugBehavior.cs, ServiceMetadataBehavior.cs : + add Binding properties. Properties are now auto. + * ServiceMetadataExtension.cs : take Binding too to build dispatcher. + 2009-08-10 Atsushi Enomoto <atsushi@ximian.com> * ServiceContractGenerator.cs : removed ChannelBase proxy stuff, diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs index ba801cf27cd..58f421e75f1 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs @@ -26,9 +26,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; +using System.Collections.Generic; using System.Runtime.Serialization; using System.ServiceModel.Channels; using System.ServiceModel.Dispatcher; +using System.Xml; namespace System.ServiceModel.Description { @@ -41,6 +43,7 @@ namespace System.ServiceModel.Description { format = new DataContractFormatAttribute (); this.operation = operation; + MaxItemsInObjectGraph = int.MaxValue; } public DataContractSerializerOperationBehavior ( @@ -49,17 +52,33 @@ namespace System.ServiceModel.Description { this.format = dataContractFormatAttribute; this.operation = operation; + MaxItemsInObjectGraph = int.MaxValue; } public DataContractFormatAttribute DataContractFormatAttribute { get { return format; } } + public bool IgnoreExtensionDataObject { get; set; } + + public int MaxItemsInObjectGraph { get; set; } + + public IDataContractSurrogate DataContractSurrogate { get; set; } + + public virtual XmlObjectSerializer CreateSerializer (Type type, string name, string ns, IList<Type> knownTypes) + { + return new DataContractSerializer (type, name, ns, knownTypes, MaxItemsInObjectGraph, IgnoreExtensionDataObject, false, DataContractSurrogate); + } + + public virtual XmlObjectSerializer CreateSerializer (Type type, XmlDictionaryString name, XmlDictionaryString ns, IList<Type> knownTypes) + { + return new DataContractSerializer (type, name, ns, knownTypes, MaxItemsInObjectGraph, IgnoreExtensionDataObject, false, DataContractSurrogate); + } + void IOperationBehavior.AddBindingParameters ( OperationDescription description, BindingParameterCollection parameters) { - throw new NotImplementedException (); } void IOperationBehavior.ApplyDispatchBehavior ( diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs index 519e3c4fd74..e0dce888d22 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs @@ -46,21 +46,20 @@ using SMMessage = System.ServiceModel.Channels.Message; namespace System.ServiceModel.Description { - [MonoTODO] + [MonoTODO ("MetadataExchangeClientMode is not considered")] public class MetadataExchangeClient { string scheme; EndpointAddress address; SMBinding binding; + MetadataExchangeClientMode mode = MetadataExchangeClientMode.MetadataExchange; + // constructors + + [MonoTODO ("use empty configuration")] public MetadataExchangeClient () { - //FIXME: Look for config element, implementing - // IMetadataExchange contract - // Use Channel<IMetadataExchange> .. ? - - throw new NotImplementedException (); } public MetadataExchangeClient (SMBinding mexBinding) @@ -81,8 +80,11 @@ namespace System.ServiceModel.Description public MetadataExchangeClient (Uri address, MetadataExchangeClientMode mode) { this.address = new EndpointAddress (address.AbsoluteUri); + this.mode = mode; } + // sync methods + public MetadataSet GetMetadata () { return GetMetadata (address); @@ -91,7 +93,7 @@ namespace System.ServiceModel.Description public MetadataSet GetMetadata (EndpointAddress address) { //FIXME: default mode? - return GetMetadataInternal (address, MetadataExchangeClientMode.MetadataExchange); + return GetMetadataInternal (address, mode); } public MetadataSet GetMetadata (Uri address, MetadataExchangeClientMode mode) @@ -99,7 +101,7 @@ namespace System.ServiceModel.Description return GetMetadataInternal (new EndpointAddress (address.AbsoluteUri), mode); } - MetadataSet GetMetadataInternal (EndpointAddress address, MetadataExchangeClientMode mode) + internal MetadataSet GetMetadataInternal (EndpointAddress address, MetadataExchangeClientMode mode) { if (binding == null) binding = MetadataExchangeBindings.CreateMexHttpBinding (); @@ -127,6 +129,44 @@ namespace System.ServiceModel.Description return MetadataSet.ReadFrom (ret.GetReaderAtBodyContents ()); } + + // async methods + + Func<Func<MetadataSet>,MetadataSet> getter; + + void PrepareGetter () + { + if (getter == null) + getter = new Func<Func<MetadataSet>,MetadataSet> (GetMetadata); + } + + public MetadataSet EndGetMetadata (IAsyncResult result) + { + return getter.EndInvoke (result); + } + + MetadataSet GetMetadata (Func<MetadataSet> func) + { + return func (); + } + + public IAsyncResult BeginGetMetadata (AsyncCallback callback, object asyncState) + { + PrepareGetter (); + return getter.BeginInvoke (() => GetMetadata (), callback, asyncState); + } + + public IAsyncResult BeginGetMetadata (EndpointAddress address, AsyncCallback callback, object asyncState) + { + PrepareGetter (); + return getter.BeginInvoke (() => GetMetadata (address), callback, asyncState); + } + + public IAsyncResult BeginGetMetadata (Uri address, MetadataExchangeClientMode mode, AsyncCallback callback, object asyncState) + { + PrepareGetter (); + return getter.BeginInvoke (() => GetMetadata (address, mode), callback, asyncState); + } } internal class MetadataProxy : ClientBase<IMetadataExchange>, IMetadataExchange diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataResolver.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataResolver.cs index 3d4fe08b4c6..84812404c26 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataResolver.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataResolver.cs @@ -47,17 +47,57 @@ namespace System.ServiceModel.Description [MonoTODO] public static class MetadataResolver { - public static ServiceEndpointCollection Resolve ( - Type contract, - EndpointAddress address) + static IEnumerable<ContractDescription> ToContracts (Type contract) { if (contract == null) throw new ArgumentNullException ("contract"); + yield return ContractDescription.GetContract (contract); + } + + public static IAsyncResult BeginResolve (Type contract, EndpointAddress address, AsyncCallback callback, object asyncState) + { + return BeginResolve (ToContracts (contract), address, callback, asyncState); + } + + public static IAsyncResult BeginResolve (IEnumerable<ContractDescription> contracts, EndpointAddress address, AsyncCallback callback, object asyncState) + { + return BeginResolve (contracts, address, MetadataExchangeClientMode.MetadataExchange, callback, asyncState); + } + + public static IAsyncResult BeginResolve (Type contract, Uri address, MetadataExchangeClientMode mode, AsyncCallback callback, object asyncState) + { + return BeginResolve (ToContracts (contract), new EndpointAddress (address), mode, callback, asyncState); + } + + public static IAsyncResult BeginResolve (IEnumerable<ContractDescription> contracts, EndpointAddress address, MetadataExchangeClientMode mode, AsyncCallback callback, object asyncState) + { + return BeginResolve (contracts, address, mode, new MetadataExchangeClient (), callback, asyncState); + } + + public static IAsyncResult BeginResolve (Type contract, EndpointAddress address, MetadataExchangeClient client, AsyncCallback callback, object asyncState) + { + return resolver.BeginInvoke (ToContracts (contract), () => client.GetMetadata (address), callback, asyncState); + } + + public static IAsyncResult BeginResolve (IEnumerable<ContractDescription> contracts, EndpointAddress address, MetadataExchangeClientMode mode, MetadataExchangeClient client, AsyncCallback callback, object asyncState) + { + return resolver.BeginInvoke (contracts, () => client.GetMetadataInternal (address, mode), callback, asyncState); + } + + delegate ServiceEndpointCollection Resolver (IEnumerable<ContractDescription> contracts, Func<MetadataSet> metadataGetter); + + static readonly Resolver resolver = new Resolver (ResolveContracts); - return ResolveContracts ( - new ContractDescription [] {ContractDescription.GetContract (contract)}, - address, - MetadataExchangeClientMode.MetadataExchange); + public static ServiceEndpointCollection EndResolve (IAsyncResult result) + { + return resolver.EndInvoke (result); + } + + public static ServiceEndpointCollection Resolve ( + Type contract, + EndpointAddress address) + { + return Resolve (ToContracts (contract), address); } public static ServiceEndpointCollection Resolve ( @@ -65,17 +105,14 @@ namespace System.ServiceModel.Description Uri address, MetadataExchangeClientMode mode) { - return ResolveContracts ( - new ContractDescription [] {ContractDescription.GetContract (contract)}, - address, - mode); + return Resolve (ToContracts (contract), address, mode); } public static ServiceEndpointCollection Resolve ( IEnumerable<ContractDescription> contracts, EndpointAddress address) { - return ResolveContracts (contracts, address, MetadataExchangeClientMode.MetadataExchange); + return Resolve (contracts, address, new MetadataExchangeClient ()); } public static ServiceEndpointCollection Resolve ( @@ -83,7 +120,7 @@ namespace System.ServiceModel.Description Uri address, MetadataExchangeClientMode mode) { - return ResolveContracts (contracts, address, mode); + return Resolve (contracts, new EndpointAddress (address), new MetadataExchangeClient (address, mode)); } public static ServiceEndpointCollection Resolve ( @@ -94,8 +131,7 @@ namespace System.ServiceModel.Description if (client == null) throw new ArgumentNullException ("client"); - /* FIXME: client is used for what? */ - return ResolveContracts (contracts, address, MetadataExchangeClientMode.MetadataExchange); + return ResolveContracts (contracts, () => client.GetMetadata (address)); } /* FIXME: What is the mode/client used for here? @@ -109,24 +145,12 @@ namespace System.ServiceModel.Description if (client == null) throw new ArgumentNullException ("client"); - return ResolveContracts (contracts, address, mode); + return ResolveContracts (contracts, () => new MetadataExchangeClient ().GetMetadata (address, mode)); } private static ServiceEndpointCollection ResolveContracts ( IEnumerable<ContractDescription> contracts, - Uri address, - MetadataExchangeClientMode mode) - { - if (address == null) - throw new ArgumentNullException ("address"); - - return ResolveContracts (contracts, new EndpointAddress (address), mode); - } - - private static ServiceEndpointCollection ResolveContracts ( - IEnumerable<ContractDescription> contracts, - EndpointAddress address, - MetadataExchangeClientMode mode) + Func<MetadataSet> metadataGetter) { if (contracts == null) throw new ArgumentNullException ("contracts"); @@ -135,11 +159,7 @@ namespace System.ServiceModel.Description if (list.Count == 0) throw new ArgumentException ("There must be atleast one ContractDescription", "contracts"); - if (address == null) - throw new ArgumentNullException ("address"); - - MetadataExchangeClient client = new MetadataExchangeClient (address); - MetadataSet metadata = client.GetMetadata (); + MetadataSet metadata = metadataGetter (); WsdlImporter importer = new WsdlImporter (metadata); ServiceEndpointCollection endpoints = importer.ImportAllEndpoints (); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDebugBehavior.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDebugBehavior.cs index 86aaecc092e..edc8a67385a 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDebugBehavior.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDebugBehavior.cs @@ -34,39 +34,23 @@ namespace System.ServiceModel.Description { public class ServiceDebugBehavior : IServiceBehavior { - bool inc_details; - bool http_help_enabled = true; - bool https_help_enabled = true; - Uri http_help_url, https_help_url; - public ServiceDebugBehavior () { } - public bool IncludeExceptionDetailInFaults { - get { return inc_details; } - set { inc_details = value; } - } + public bool IncludeExceptionDetailInFaults { get; set; } - public bool HttpHelpPageEnabled { - get { return http_help_enabled; } - set { http_help_enabled = value; } - } + public bool HttpHelpPageEnabled { get; set; } - public Uri HttpHelpPageUrl { - get { return http_help_url; } - set { http_help_url = value; } - } + public Uri HttpHelpPageUrl { get; set; } - public bool HttpsHelpPageEnabled { - get { return https_help_enabled; } - set { https_help_enabled = value; } - } + public bool HttpsHelpPageEnabled { get; set; } - public Uri HttpsHelpPageUrl { - get { return https_help_url; } - set { https_help_url = value; } - } + public Uri HttpsHelpPageUrl { get; set; } + + public Binding HttpHelpPageBinding { get; set; } + + public Binding HttpsHelpPageBinding { get; set; } void IServiceBehavior.AddBindingParameters ( ServiceDescription description, @@ -90,13 +74,13 @@ namespace System.ServiceModel.Description if (HttpHelpPageEnabled) { Uri uri = serviceHostBase.CreateUri ("http", HttpHelpPageUrl); if (uri != null) - ServiceMetadataExtension.EnsureServiceMetadataHttpChanelDispatcher (description, serviceHostBase, sme, uri); + ServiceMetadataExtension.EnsureServiceMetadataHttpChanelDispatcher (description, serviceHostBase, sme, uri, HttpHelpPageBinding); } if (HttpsHelpPageEnabled) { Uri uri = serviceHostBase.CreateUri ("https", HttpsHelpPageUrl); if (uri != null) - ServiceMetadataExtension.EnsureServiceMetadataHttpsChanelDispatcher (description, serviceHostBase, sme, uri); + ServiceMetadataExtension.EnsureServiceMetadataHttpsChanelDispatcher (description, serviceHostBase, sme, uri, HttpsHelpPageBinding); } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataBehavior.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataBehavior.cs index 36f83989712..dca58b48072 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataBehavior.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataBehavior.cs @@ -41,45 +41,31 @@ namespace System.ServiceModel.Description { public const string MexContractName = "IMetadataExchange"; - bool enable_http, enable_https; - Uri http_url, https_url, location; MetadataExporter exporter; public ServiceMetadataBehavior () { } - public bool HttpGetEnabled { - get { return enable_http; } - set { enable_http = value; } - } + public bool HttpGetEnabled { get; set; } - public bool HttpsGetEnabled { - get { return enable_https; } - set { enable_https = value; } - } + public bool HttpsGetEnabled { get; set; } public MetadataExporter MetadataExporter { get { return exporter ?? (exporter = new WsdlExporter ()); } set { exporter = value; } } - public Uri ExternalMetadataLocation { - get { return location; } - set { location = value; } - } + public Uri ExternalMetadataLocation { get; set; } - public Uri HttpGetUrl { - get { return http_url; } - set { http_url = value; } - } + public Uri HttpGetUrl { get; set; } - public Uri HttpsGetUrl { - get { return https_url; } - set { https_url = value; } - } + public Uri HttpsGetUrl { get; set; } + + public Binding HttpGetBinding { get; set; } + + public Binding HttpsGetBinding { get; set; } - [MonoTODO] void IServiceBehavior.AddBindingParameters ( ServiceDescription description, ServiceHostBase serviceHostBase, @@ -110,13 +96,13 @@ namespace System.ServiceModel.Description if (HttpGetEnabled) { Uri uri = serviceHostBase.CreateUri ("http", HttpGetUrl); if (uri != null) - ServiceMetadataExtension.EnsureServiceMetadataHttpChanelDispatcher (description, serviceHostBase, sme, uri); + ServiceMetadataExtension.EnsureServiceMetadataHttpChanelDispatcher (description, serviceHostBase, sme, uri, HttpGetBinding); } if (HttpsGetEnabled) { Uri uri = serviceHostBase.CreateUri ("https", HttpsGetUrl); if (uri != null) - ServiceMetadataExtension.EnsureServiceMetadataHttpsChanelDispatcher (description, serviceHostBase, sme, uri); + ServiceMetadataExtension.EnsureServiceMetadataHttpsChanelDispatcher (description, serviceHostBase, sme, uri, HttpsGetBinding); } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs index 5dc8af1bacd..efb346bdf21 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs @@ -44,7 +44,7 @@ using System.Xml.Schema; using WSServiceDescription = System.Web.Services.Description.ServiceDescription; using WSMessage = System.Web.Services.Description.Message; using SMMessage = System.ServiceModel.Channels.Message; - +using WCFBinding = System.ServiceModel.Channels.Binding; namespace System.ServiceModel.Description { @@ -91,14 +91,25 @@ namespace System.ServiceModel.Description return sme; } - internal static void EnsureServiceMetadataHttpChanelDispatcher (ServiceDescription description, ServiceHostBase serviceHostBase, ServiceMetadataExtension sme, Uri uri) { + internal static void EnsureServiceMetadataHttpChanelDispatcher (ServiceDescription description, ServiceHostBase serviceHostBase, ServiceMetadataExtension sme, Uri uri, WCFBinding binding) + { + EnsureServiceMetadataDispatcher (description, serviceHostBase, sme, uri, binding ?? MetadataExchangeBindings.CreateMexHttpBinding ()); + } + + internal static void EnsureServiceMetadataHttpsChanelDispatcher (ServiceDescription description, ServiceHostBase serviceHostBase, ServiceMetadataExtension sme, Uri uri, WCFBinding binding) + { + // same as http now. + EnsureServiceMetadataDispatcher (description, serviceHostBase, sme, uri, binding ?? MetadataExchangeBindings.CreateMexHttpsBinding ()); + } + static void EnsureServiceMetadataDispatcher (ServiceDescription description, ServiceHostBase serviceHostBase, ServiceMetadataExtension sme, Uri uri, WCFBinding binding) + { if (sme._serviceMetadataChanelDispatchers == null) sme._serviceMetadataChanelDispatchers = new Dictionary<Uri, ChannelDispatcherBase> (); else if (sme._serviceMetadataChanelDispatchers.ContainsKey (uri)) return; - CustomBinding cb = new CustomBinding (new BasicHttpBinding ()) + CustomBinding cb = new CustomBinding (binding) { Name = ServiceMetadataBehaviorHttpGetBinding, }; @@ -117,10 +128,6 @@ namespace System.ServiceModel.Description serviceHostBase.ChannelDispatchers.Add (channelDispatcher); } - internal static void EnsureServiceMetadataHttpsChanelDispatcher (ServiceDescription description, ServiceHostBase serviceHostBase, ServiceMetadataExtension sme, Uri uri) { - throw new NotImplementedException (); - } - void IExtension<ServiceHostBase>.Attach (ServiceHostBase owner) { this.owner = owner; diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs index dbe680b6e56..572f79a0fa8 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs @@ -157,8 +157,10 @@ namespace System.ServiceModel.Dispatcher { int index = 0; foreach (ParameterInfo pi in requestMethodParams) - if (!pi.IsOut) - parameters [pi.Position] = parts [index++]; + if (!pi.IsOut) { + parameters [index] = parts [index]; + index++; + } } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog index b4f30d194bd..f7bc425ec96 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog @@ -1,3 +1,19 @@ +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * EndpointDispatcher.cs : do not try to create wrong filter. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * ChannelDispatcher.cs : EndpointNotFoundException message could + be a bit kindful. + +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * IOperationInvoker.cs : fix interface. + * DefaultOperationInvoker.cs : refresh implementation of the above. + * BaseMessagesFormatter.cs, OperationInvokerHandler.cs : + dependent changes for above. + 2009-08-07 Atsushi Enomoto <atsushi@ximian.com> * InputOrReplyRequestProcessor.cs : now it could return an instance diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs index 234b647ab91..4ad1ab0804f 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs @@ -568,7 +568,7 @@ namespace System.ServiceModel.Dispatcher } } if (candidate == null) - throw new EndpointNotFoundException (String.Format ("The request message has the target '{0}' which is not reachable in this service contract", message.Headers.To)); + throw new EndpointNotFoundException (String.Format ("The request message has the target '{0}' with action '{1}' which is not reachable in this service contract", message.Headers.To, message.Headers.Action)); return candidate; } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DefaultOperationInvoker.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DefaultOperationInvoker.cs new file mode 100644 index 00000000000..44912ba54fd --- /dev/null +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DefaultOperationInvoker.cs @@ -0,0 +1,131 @@ +// +// DefaultOperationInvoker.cs +// +// Author: Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (C) 2009 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.ServiceModel; +using System.ServiceModel.Description; +using System.Reflection; +using System.Threading; + +namespace System.ServiceModel.Dispatcher +{ + class DefaultOperationInvoker : IOperationInvoker + { + readonly OperationDescription od; + readonly ParameterInfo [] in_params, out_params; + + public DefaultOperationInvoker (OperationDescription od) + { + this.od = od; + var mi = od.SyncMethod ?? od.BeginMethod; + var il = new List<ParameterInfo> (); + var ol = new List<ParameterInfo> (); + var pl = mi.GetParameters (); + int count = mi == od.BeginMethod ? pl.Length - 2 : pl.Length; + for (int i = 0; i < count; i++) { + var pi = pl [i]; + if (!pi.IsOut) + il.Add (pi); + if (pi.IsOut) + ol.Add (pi); + } + in_params = il.ToArray (); + out_params = ol.ToArray (); + } + + public bool IsSynchronous { + get { return true; } + } + + public object [] AllocateInputs () + { + return new object [in_params.Length]; + } + + public object Invoke (object instance, object [] inputs, out object [] outputs) + { + var arr = new object [in_params.Length + out_params.Length]; + for (int i = 0; i < in_params.Length; i++) + arr [in_params [i].Position] = inputs [i]; + + var ret = od.SyncMethod.Invoke (instance, arr); + + outputs = new object [out_params.Length]; + for (int i = 0; i < out_params.Length; i++) + outputs [i] = arr [out_params [i].Position]; + + return ret; + } + + public IAsyncResult InvokeBegin (object instance, object [] inputs, AsyncCallback callback, object state) + { + var arr = new object [in_params.Length + out_params.Length + 2]; + for (int i = 0; i < in_params.Length; i++) + arr [in_params [i].Position] = inputs [i]; + arr [arr.Length - 2] = callback; + arr [arr.Length - 1] = state; + return new InvokeAsyncResult (arr, (IAsyncResult) od.BeginMethod.Invoke (instance, arr)); + } + + public object InvokeEnd (object instance, out object [] outputs, IAsyncResult result) + { + var r = (InvokeAsyncResult) result; + var ret = od.EndMethod.Invoke (instance, new object [] {r.Source}); + var arr = r.Parameters; + outputs = new object [out_params.Length]; + for (int i = 0; i < out_params.Length; i++) + outputs [i] = arr [out_params [i].Position]; + return ret; + } + + class InvokeAsyncResult : IAsyncResult + { + public InvokeAsyncResult (object [] parameters, IAsyncResult source) + { + Source = source; + Parameters = parameters; + } + + public IAsyncResult Source; + public object [] Parameters; + + public WaitHandle AsyncWaitHandle { + get { return Source.AsyncWaitHandle; } + } + public bool CompletedSynchronously { + get { return Source.CompletedSynchronously; } + } + public bool IsCompleted { + get { return Source.IsCompleted; } + } + public object AsyncState { + get { return Source.AsyncState; } + } + } + } +} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs index eecb1028fcc..950a7b2664b 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs @@ -86,7 +86,7 @@ namespace System.ServiceModel.Dispatcher } public MessageFilter AddressFilter { - get { return address_filter ?? (address_filter = new EndpointAddressMessageFilter (EndpointAddress)); } + get { return address_filter; } set { if (value == null) throw new ArgumentNullException ("value"); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/IOperationInvoker.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/IOperationInvoker.cs index 048a47bb5cf..077d0f0b7a5 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/IOperationInvoker.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/IOperationInvoker.cs @@ -32,8 +32,8 @@ namespace System.ServiceModel.Dispatcher public interface IOperationInvoker { bool IsSynchronous { get; } - object [] AllocateParameters (); - object Invoke (object instance, object [] inputs); + object [] AllocateInputs (); + object Invoke (object instance, object [] inputs, out object [] outputs); IAsyncResult InvokeBegin (object instance, object [] inputs, AsyncCallback callback, object state); object InvokeEnd (object instance, out object [] outputs, IAsyncResult result); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs index 6706a4d2da6..ddd69161033 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/OperationInvokerHandler.cs @@ -31,12 +31,12 @@ namespace System.ServiceModel.Dispatcher DispatchOperation operation = mrc.Operation; Message req = mrc.IncomingMessage; object instance = mrc.InstanceContext.GetServiceInstance(req); - object [] parameters; + object [] parameters, outParams; BuildInvokeParams (mrc, out parameters); if (operation.Invoker.IsSynchronous) { - object result = operation.Invoker.Invoke (instance, parameters); - HandleInvokeResult (mrc, parameters, result); + object result = operation.Invoker.Invoke (instance, parameters, out outParams); + HandleInvokeResult (mrc, outParams, result); } else {// asynchronous InvokeAsynchronous (mrc, instance, parameters); } @@ -112,7 +112,7 @@ namespace System.ServiceModel.Dispatcher EnsureValid (operation); if (operation.DeserializeRequest) { - parameters = operation.Invoker.AllocateParameters (); + parameters = operation.Invoker.AllocateInputs (); operation.Formatter.DeserializeRequest (mrc.IncomingMessage, parameters); } else parameters = new object [] { mrc.IncomingMessage }; diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog index 4c9e23df3a2..df8f77089ad 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog @@ -1,3 +1,25 @@ +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * IPeerConnectorContract.cs : use wildcard for the actual message + transfer operation. + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * IPeerConnectorContract.cs : fix internal member name to get + serialized correctly. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * IPeerConnectorContract.cs : add itself as CallbackContract. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * IPeerConnectorContract.cs : remove receiver contract. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * IPeerConnectorContract.cs : add Disconnect() to receiver contract. + 2009-08-07 Atsushi Enomoto <atsushi@ximian.com> * IPeerConnectorContract.cs : add callback contract. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/IPeerConnectorContract.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/IPeerConnectorContract.cs index a63f1551b26..562f6bbe670 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/IPeerConnectorContract.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/IPeerConnectorContract.cs @@ -12,7 +12,7 @@ namespace System.ServiceModel.PeerResolvers public const string Namespace = "http://schemas.microsoft.com/net/2006/05/peer"; } - [ServiceContract (Namespace = Consts.Namespace, SessionMode = SessionMode.Allowed)] + [ServiceContract (Namespace = Consts.Namespace, SessionMode = SessionMode.Allowed, CallbackContract = typeof (IPeerConnectorContract))] internal interface IPeerConnectorContract { [OperationContract (Action = Consts.Namespace + "/Connect", IsOneWay = true)] @@ -33,17 +33,7 @@ namespace System.ServiceModel.PeerResolvers [OperationContract (Action = Consts.Namespace + "/Ping", IsOneWay = true)] void Ping (); - [OperationContract (IsOneWay = true)] - void SendMessage (Message msg); - } - - [ServiceContract (Namespace = Consts.Namespace, SessionMode = SessionMode.Allowed, CallbackContract = typeof (IPeerConnectorContract))] - internal interface IPeerReceiverContract - { - [OperationContract (Action = Consts.Namespace + "/Connect", IsOneWay = true)] - void Connect (ConnectInfo connect); - - [OperationContract (IsOneWay = true)] + [OperationContract (Action = "*", IsOneWay = true)] void SendMessage (Message msg); } @@ -80,7 +70,7 @@ namespace System.ServiceModel.PeerResolvers internal class ConnectInfoDC { [DataMember] - public PeerNodeAddress PeerNodeAddress { get; set; } + public PeerNodeAddress Address { get; set; } [DataMember] public ulong NodeId { get; set; } } @@ -96,9 +86,9 @@ namespace System.ServiceModel.PeerResolvers [MessageBodyMember (Name = "Connect", Namespace = Consts.Namespace)] ConnectInfoDC dc; - public PeerNodeAddress PeerNodeAddress { - get { return dc.PeerNodeAddress; } - set { dc.PeerNodeAddress = value; } + public PeerNodeAddress Address { + get { return dc.Address; } + set { dc.Address = value; } } public ulong NodeId { diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources index 1388bb1bc52..0f2fbd4ef3d 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources +++ b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources @@ -614,6 +614,7 @@ System.ServiceModel.Dispatcher/ClientOperation.cs System.ServiceModel.Dispatcher/ClientRuntime.cs System.ServiceModel.Dispatcher/DataContractSerializerServiceBehavior.cs System.ServiceModel.Dispatcher/DefaultInstanceContextProvider.cs +System.ServiceModel.Dispatcher/DefaultOperationInvoker.cs System.ServiceModel.Dispatcher/DispatchOperation.cs System.ServiceModel.Dispatcher/DispatchRuntime.cs System.ServiceModel.Dispatcher/EndpointAddressMessageFilter.cs diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/AllEnums.cs b/mcs/class/System.ServiceModel/System.ServiceModel/AllEnums.cs index 47a210cc282..73065cf8f8b 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/AllEnums.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/AllEnums.cs @@ -37,6 +37,13 @@ namespace System.ServiceModel.Activation namespace System.ServiceModel { + public enum AddressFilterMode + { + Exact, + Prefix, + Any + } + public enum AuditLevel { None, @@ -309,6 +316,13 @@ namespace System.ServiceModel.Channels LaxTimestampLast, } + public enum SupportedAddressingMode + { + Anonymous, + NonAnonymous, + Mixed + } + public enum TransferSession { None, diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog index 7d9177c3ea8..32ca9122552 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog @@ -1,3 +1,44 @@ +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceHostBase.cs : wildcard action support was not working + for one-way channels. + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceHostBase.cs : set expected AddressFilter. + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * EndpointAddress.cs : #if !NET_2_1 is removing code too much. + +2009-08-17 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceRuntimeChannel.cs : made some properties in duplex context + channel dispatching to internal client. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * OperationContextScope.cs : check null arg. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceRuntimeChannel.cs : return timeouts that are set at + dispatch runtime later than its .ctor(). Provide ListenUri too. + +2009-08-14 Atsushi Enomoto <atsushi@ximian.com> + + * AllEnums.cs : add AddressFilterMode and SupportedAddressingMode. + * ServiceBehaviorAttribute.cs : added missing properties. + +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * ClientBase.cs : (ChannelBase) now ClientRuntimeChannel demands an + explicit address. + +2009-08-11 Atsushi Enomoto <atsushi@ximian.com> + + * ServiceHostBase.cs : use new IOperationInvoker implementation. + 2009-08-07 Atsushi Enomoto <atsushi@ximian.com> * ServiceRuntimeChannel.cs : change .ctor() args. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs index fb45ca455ca..b07ac73b5f9 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs @@ -398,7 +398,7 @@ namespace System.ServiceModel internal ClientRuntimeChannel Inner { get { if (inner_channel == null) - inner_channel = new ClientRuntimeChannel (endpoint, factory, null, null); + inner_channel = new ClientRuntimeChannel (endpoint, factory, endpoint.Address, null); return inner_channel; } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs index 512051559f9..8d76cb67cbf 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs @@ -184,7 +184,7 @@ namespace System.ServiceModel return ! (address1 == address2); } -#if !NET_2_1 +//#if !NET_2_1 [MonoTODO] public static EndpointAddress ReadFrom ( XmlDictionaryReader reader) @@ -278,7 +278,6 @@ namespace System.ServiceModel AddressingVersion addressingVersion, XmlReader reader) { Uri uri = null; - MetadataSet metadata = null; EndpointIdentity identity = null; reader.MoveToContent (); if (reader.LocalName == "Address" && @@ -292,6 +291,8 @@ namespace System.ServiceModel addressingVersion.Namespace, reader.LocalName, reader.NamespaceURI)); reader.MoveToContent (); +#if !NET_2_1 + MetadataSet metadata = null; if (reader.LocalName == "Metadata" && reader.NamespaceURI == addressingVersion.Namespace && !reader.IsEmptyElement) { @@ -306,16 +307,20 @@ namespace System.ServiceModel // FIXME: implement reader.Skip (); } +#endif if (addressingVersion == AddressingVersion.WSAddressing10 && uri == w3c_anonymous) uri = anonymous_role; +#if NET_2_1 + return new EndpointAddress (uri, identity); +#else if (metadata == null) return new EndpointAddress (uri, identity); return new EndpointAddress (uri, identity, AddressHeader.CreateAddressHeader (metadata)); - } #endif + } public override string ToString () { diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/OperationContextScope.cs b/mcs/class/System.ServiceModel/System.ServiceModel/OperationContextScope.cs index 089e1945926..d4a38f63bb1 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/OperationContextScope.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/OperationContextScope.cs @@ -41,6 +41,8 @@ namespace System.ServiceModel public OperationContextScope (OperationContext context) { + if (context == null) + throw new ArgumentNullException ("context"); previous = OperationContext.Current; OperationContext.Current = context; } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs index 6d5d82110bf..f946e09214a 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs @@ -57,6 +57,16 @@ namespace System.ServiceModel object singleton; [MonoTODO] + public string Name { get; set; } + [MonoTODO] + public string Namespace { get; set; } + [MonoTODO] + public string ConfigurationName { get; set; } + + [MonoTODO] + public AddressFilterMode AddressFilterMode { get; set; } + + [MonoTODO] public bool AutomaticSessionShutdown { get; set; } [MonoTODO] diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs index 95c341806d8..5add53257d0 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs @@ -389,8 +389,8 @@ namespace System.ServiceModel } - internal ChannelDispatcher BuildChannelDispatcher (ServiceEndpoint se, BindingParameterCollection commonParams) { - + internal ChannelDispatcher BuildChannelDispatcher (ServiceEndpoint se, BindingParameterCollection commonParams) + { //User the binding parameters to build the channel listener and Dispatcher IChannelListener lf = BuildListener (se, commonParams); ChannelDispatcher cd = new ChannelDispatcher ( @@ -404,6 +404,7 @@ namespace System.ServiceModel new EndpointDispatcher (se.Address, se.Contract.Name, se.Contract.Namespace); endpoint_dispatcher.DispatchRuntime.Type = Description.ServiceType; endpoint_dispatcher.ContractFilter = GetContractFilter (se.Contract); + endpoint_dispatcher.AddressFilter = new EndpointAddressMessageFilter (se.Address); endpoint_dispatcher.ChannelDispatcher = cd; cd.Endpoints.Add (endpoint_dispatcher); @@ -463,7 +464,7 @@ namespace System.ServiceModel od.IsOneWay ? new DispatchOperation (db, od.Name, reqA) : new DispatchOperation (db, od.Name, reqA, resA); - bool has_void_reply = false; + bool no_serialized_reply = od.IsOneWay; foreach (MessageDescription md in od.Messages) { if (md.Direction == MessageDirection.Input && md.Body.Parts.Count == 1 && @@ -474,25 +475,21 @@ namespace System.ServiceModel if (md.Body.ReturnValue.Type == typeof (Message)) o.SerializeReply = false; else if (md.Body.ReturnValue.Type == typeof (void)) - has_void_reply = true; + no_serialized_reply = true; } } // Setup Invoker - // FIXME: support async method - if (od.SyncMethod != null) - o.Invoker = new SyncMethodInvoker (od.SyncMethod); - else - o.Invoker = new AsyncMethodInvoker (od.BeginMethod, od.EndMethod); + o.Invoker = new DefaultOperationInvoker (od); // Setup Formater o.Formatter = BaseMessagesFormatter.Create (od); - if (o.Action == "*" && o.ReplyAction == "*") { + if (o.Action == "*" && (o.IsOneWay || o.ReplyAction == "*")) { //Signature : Message (Message) // : void (Message) //FIXME: void (IChannel) - if (!o.DeserializeRequest && (!o.SerializeReply || has_void_reply)) + if (!o.DeserializeRequest && (!o.SerializeReply || no_serialized_reply)) // what is this double-ish check for? db.UnhandledDispatchOperation = o; } @@ -612,6 +609,7 @@ namespace System.ServiceModel Close (); } + /* class SyncMethodInvoker : IOperationInvoker { readonly MethodInfo _methodInfo; @@ -692,5 +690,7 @@ namespace System.ServiceModel #endregion } + */ } + } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs index 99b5f9740e4..1cf72776b87 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs @@ -48,6 +48,16 @@ namespace System.ServiceModel ClientRuntimeChannel client; + public override bool AllowOutputBatching { + get { return client.AllowOutputBatching; } + set { client.AllowOutputBatching = value; } + } + + public virtual TimeSpan OperationTimeout { + get { return client.OperationTimeout; } + set { client.OperationTimeout = value; } + } + public bool AutomaticInputSessionShutdown { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } @@ -95,21 +105,19 @@ namespace System.ServiceModel internal class ServiceRuntimeChannel : CommunicationObject, IServiceChannel { IExtensionCollection<IContextChannel> extensions; - readonly IChannel channel; - readonly TimeSpan _openTimeout; - readonly TimeSpan _closeTimeout; + readonly IChannel channel; + readonly DispatchRuntime runtime; public ServiceRuntimeChannel (IChannel channel, DispatchRuntime runtime) { this.channel = channel; - this._openTimeout = runtime.ChannelDispatcher.DefaultOpenTimeout; - this._closeTimeout = runtime.ChannelDispatcher.DefaultCloseTimeout; + this.runtime = runtime; } #region IContextChannel [MonoTODO] - public bool AllowOutputBatching { get; set; } + public virtual bool AllowOutputBatching { get; set; } public IInputSession InputSession { get { @@ -132,7 +140,7 @@ namespace System.ServiceModel } [MonoTODO] - public TimeSpan OperationTimeout { get; set; } + public virtual TimeSpan OperationTimeout { get; set; } public IOutputSession OutputSession { get { @@ -157,11 +165,11 @@ namespace System.ServiceModel // CommunicationObject protected internal override TimeSpan DefaultOpenTimeout { - get { return _openTimeout; } + get { return runtime.ChannelDispatcher.DefaultOpenTimeout; } } protected internal override TimeSpan DefaultCloseTimeout { - get { return _closeTimeout; } + get { return runtime.ChannelDispatcher.DefaultCloseTimeout; } } protected override void OnAbort () @@ -217,7 +225,7 @@ namespace System.ServiceModel } public Uri ListenUri { - get { throw new NotImplementedException (); } + get { return runtime.ChannelDispatcher.Listener.Uri; } } #region IDisposable Members |