Jelajahi Sumber

2009-07-23 Atsushi Enomoto <[email protected]>

	* TcpReplyChannel.cs, TcpRequestChannel.cs: it somehow adds/expects
	  ReplyTo and MessageId (though it is session-less), and it expects
	  EndRecord at weird stage, inconsistent with [MC-NMF]...
	  Now .NET service accepts one mono client request.


svn path=/trunk/mcs/; revision=138499
Atsushi Eno 16 tahun lalu
induk
melakukan
1ce9d1db36

+ 7 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog

@@ -1,3 +1,10 @@
+2009-07-23  Atsushi Enomoto  <[email protected]>
+
+	* TcpReplyChannel.cs, TcpRequestChannel.cs: it somehow adds/expects
+	  ReplyTo and MessageId (though it is session-less), and it expects
+	  EndRecord at weird stage, inconsistent with [MC-NMF]...
+	  Now .NET service accepts one mono client request.
+
 2009-07-23  Atsushi Enomoto  <[email protected]>
 
 	* TcpReplyChannel.cs, TcpRequestChannel.cs, TcpBinaryFrameManager.cs:

+ 5 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpReplyChannel.cs

@@ -58,6 +58,8 @@ namespace System.ServiceModel.Channels
 			if (timeout <= TimeSpan.Zero)
 				throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
 			var msg = frame.ReadUnsizedMessage (timeout);
+			// It somehow receives EndRecord now ...
+			frame.ProcessEndRecordRecipient ();
 			return new TcpRequestContext (this, msg);
 		}
 
@@ -88,9 +90,11 @@ namespace System.ServiceModel.Channels
 
 			public override void Reply (Message message, TimeSpan timeout)
 			{
+				if (message.Headers.RelatesTo == null)
+					message.Headers.RelatesTo = request.Headers.MessageId;
+
 				DateTime start = DateTime.Now;
 				owner.frame.WriteUnsizedMessage (message, timeout);
-				owner.frame.ProcessEndRecordRecipient ();
 				owner.frame.ProcessEndRecordInitiator ();
 			}
 		}

+ 11 - 3
mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpRequestChannel.cs

@@ -1,10 +1,10 @@
 //
-// HttpRequestChannel.cs
+// TcpRequestChannel.cs
 //
 // Author:
 //	Atsushi Enomoto <[email protected]>
 //
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.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
@@ -33,6 +33,7 @@ using System.Net.Sockets;
 using System.ServiceModel;
 using System.ServiceModel.Description;
 using System.Threading;
+using System.Xml;
 
 namespace System.ServiceModel.Channels
 {
@@ -83,10 +84,17 @@ namespace System.ServiceModel.Channels
 
 			if (input.Headers.To == null)
 				input.Headers.To = RemoteAddress.Uri;
+			if (input.Headers.ReplyTo == null)
+				input.Headers.ReplyTo = new EndpointAddress (Constants.WsaAnonymousUri);
+			if (input.Headers.MessageId == null)
+				input.Headers.MessageId = new UniqueId ();
 
 			frame.WriteUnsizedMessage (input, timeout);
-			var ret = frame.ReadUnsizedMessage (timeout - (DateTime.Now - start));
+
+			// It somehow sends EndRecord now ...
 			frame.ProcessEndRecordInitiator ();
+
+			var ret = frame.ReadUnsizedMessage (timeout - (DateTime.Now - start));
 			frame.ProcessEndRecordRecipient (); // both
 			return ret;
 		}