Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / System.Runtime.Remoting / System.Runtime.Remoting.Channels / SoapServerFormatterSink.cs
index ec26fda61cc2254a40439a9780778a6ea86ef256..d818bca48c7d190ac2309ed9459ba150728e93dc 100644 (file)
@@ -86,7 +86,6 @@ namespace System.Runtime.Remoting.Channels {
                        }\r
                }\r
 \r
-#if NET_1_1\r
                [ComVisible(false)]\r
                public TypeFilterLevel TypeFilterLevel\r
                {\r
@@ -98,7 +97,6 @@ namespace System.Runtime.Remoting.Channels {
                                _soapCore = new SoapCore (this, props, SoapServerFormatterSinkProvider.AllowedProperties);\r
                        }\r
                }\r
-#endif\r
 \r
                public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state,\r
                                                  IMessage msg, ITransportHeaders headers, Stream stream)\r
@@ -146,18 +144,14 @@ namespace System.Runtime.Remoting.Channels {
                        // Note that a null content-type is handled as suitable,\r
                        // otherwise no other sink will be able to handle the request.\r
                        string contentType = requestHeaders["Content-Type"] as string;\r
-                       if (contentType != null && !contentType.StartsWith ("text/xml")) {\r
-                               try {\r
-                                       return next_sink.ProcessMessage (sinkStack,\r
-                                               requestMsg,\r
-                                               requestHeaders,\r
-                                               requestStream,\r
-                                               out responseMsg,\r
-                                               out responseHeaders,\r
-                                               out responseStream);\r
-                               } catch {\r
-                                       // Let this formatter handle the exception.\r
-                               }\r
+                       if (contentType == null || !contentType.StartsWith ("text/xml") || requestHeaders["SOAPAction"] == null) {\r
+                               return next_sink.ProcessMessage (sinkStack,\r
+                                       requestMsg,\r
+                                       requestHeaders,\r
+                                       requestStream,\r
+                                       out responseMsg,\r
+                                       out responseHeaders,\r
+                                       out responseStream);\r
                        }\r
 \r
                        responseMsg = null;\r
@@ -179,7 +173,6 @@ namespace System.Runtime.Remoting.Channels {
                                SoapFormatter fm = _soapCore.GetSafeDeserializer ();\r
                                SoapMessage soapMessage = soapMsgFormatter.CreateSoapMessage (true);\r
                                fm.TopObject = soapMessage;\r
-                               requestStream.Position = 0;\r
                                fm.Deserialize(requestStream);\r
 \r
                                requestMsg = soapMsgFormatter.BuildMethodCallFromSoapMessage(soapMessage, uri);\r
@@ -192,6 +185,7 @@ namespace System.Runtime.Remoting.Channels {
                                                object rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders);\r
                                                responseStream = new MemoryStream();\r
                                                _soapCore.Serializer.Serialize(responseStream, rtnMessageObject);\r
+                                               responseStream.Position = 0;\r
                                        }\r
                                }\r
                        }\r
@@ -201,6 +195,7 @@ namespace System.Runtime.Remoting.Channels {
                                object rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders);\r
                                responseStream = new MemoryStream();\r
                                _soapCore.Serializer.Serialize(responseStream, rtnMessageObject);\r
+                               responseStream.Position = 0;\r
                                sp = ServerProcessing.Complete;\r
                        }\r
 \r