All pastes #284536 Raw Edit

Anonymous

public text v1 · immutable
#284536 ·published 2006-12-19 03:12 UTC
rendered paste body
Index: System.Web.Services.Protocols/WebServiceHandlerFactory.cs
===================================================================
--- System.Web.Services.Protocols/WebServiceHandlerFactory.cs	(revision 69699)
+++ System.Web.Services.Protocols/WebServiceHandlerFactory.cs	(working copy)
@@ -113,6 +113,7 @@
 			supported = WSConfig.IsSupported (protocol);
 			if (!supported) {
 				switch (protocol) {
+					case WSProtocol.HttpSoap12:
 					case WSProtocol.HttpSoap:
 						supported = WSConfig.IsSupported (WSProtocol.HttpSoap12);
 						break;
@@ -131,6 +132,7 @@
 				throw new InvalidOperationException ("Unsupported request format.");
 
 			switch (protocol) {
+			case WSProtocol.HttpSoap12:
 			case WSProtocol.HttpSoap:
 				handler = GetTypeHandler (context, new HttpSoapWebServiceHandler (type));
 				break;
@@ -173,7 +175,12 @@
 				if (context.Request.RequestType == "GET")
 					return WSProtocol.Documentation;
 				else
+#if NET_2_0
+					return context.Request.Headers ["SOAPAction"] != null ?
+						WSProtocol.HttpSoap : WSProtocol.HttpSoap12;
+#else
 					return WSProtocol.HttpSoap;
+#endif
 			}
 			else
 			{
Index: System.Web.Services.Protocols/SoapClientMessage.cs
===================================================================
--- System.Web.Services.Protocols/SoapClientMessage.cs	(revision 69699)
+++ System.Web.Services.Protocols/SoapClientMessage.cs	(working copy)
@@ -59,6 +59,8 @@
 			this.client = client;
 			this.url = url;
 			Parameters = parameters;
+			if (SoapVersion == SoapProtocolVersion.Soap12)
+				ContentType = "application/soap+xml";
 		}
 
 		#endregion 
Index: System.Web.Services.Protocols/Fault12.cs
===================================================================
--- System.Web.Services.Protocols/Fault12.cs	(revision 69699)
+++ System.Web.Services.Protocols/Fault12.cs	(working copy)
@@ -75,7 +75,8 @@
 		{
 			Code = new Soap12FaultCode ();
 			Code.Value = ex.Code;
-			Code.Subcode = CreateFaultCode (ex.SubCode);
+			if (ex.SubCode != null)
+				Code.Subcode = CreateFaultCode (ex.SubCode);
 			Node = ex.Node;
 			Role = ex.Role;
 			Reason = new Soap12FaultReason ();
@@ -99,6 +100,8 @@
 
 		static Soap12FaultCode CreateFaultCode (SoapFaultSubCode code)
 		{
+			if (code == null)
+				throw new ArgumentNullException ("code");
 			Soap12FaultCode ret = new Soap12FaultCode ();
 			ret.Value = code.Code;
 			if (code.SubCode != null)
Index: System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
===================================================================
--- System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs	(revision 69699)
+++ System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs	(working copy)
@@ -272,7 +272,13 @@
 			if ((message.ContentEncoding != null) && (message.ContentEncoding.Length > 0))
 				response.AppendHeader("Content-Encoding", message.ContentEncoding);
 
+#if NET_2_0
+			response.ContentType = message.SoapVersion == SoapProtocolVersion.Soap12 ?
+				"application/soap+xml; charset=utf-8" :
+				"text/xml; charset=utf-8";
+#else
 			response.ContentType = "text/xml; charset=utf-8";
+#endif
 			if (message.Exception != null) response.StatusCode = 500;
 
 			Stream responseStream = response.OutputStream;
Index: System.Web.Services.Protocols/SoapHttpClientProtocol.cs
===================================================================
--- System.Web.Services.Protocols/SoapHttpClientProtocol.cs	(revision 69699)
+++ System.Web.Services.Protocols/SoapHttpClientProtocol.cs	(working copy)
@@ -202,7 +202,12 @@
 			WebRequest request = GetWebRequest (uri);
 			request.Method = "POST";
 			WebHeaderCollection headers = request.Headers;
+#if NET_2_0
+			if (message.SoapVersion != SoapProtocolVersion.Soap12)
+				headers.Add ("SOAPAction", "\"" + message.Action + "\"");
+#else
 			headers.Add ("SOAPAction", "\"" + message.Action + "\"");
+#endif
 			request.ContentType = message.ContentType + "; charset=utf-8";
 			return request;
 		}