2006-12-19 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Tue, 19 Dec 2006 05:52:02 +0000 (05:52 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Tue, 19 Dec 2006 05:52:02 +0000 (05:52 -0000)
        * SoapHttpClientProtocol.cs :
          Don't use HTTP header when SoapVersion is Soap12.
        * HttpSoapWebServiceHandler.cs :
          With SOAP 1.2 message we can only use Body content.
          Set correct Content-Type for SOAP 1.2 message.
        * Fault12.cs : added null check.
        * SoapClientMessage.cs :
          Set correct Content-Type for SOAP 1.2 message.
        * WebServiceHandlerFactory.cs :
          don't reject SOAP 1.2 protocol here.

svn path=/branches/atsushi/mcs/; revision=69710

mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapClientMessage.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs

index 6bf30f45d7e8e62a9f5d8aebe05806876a1a97b6..bdc31c9d78b08b701b6303484da65ce1537a7646 100644 (file)
@@ -1,3 +1,16 @@
+2006-12-19  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * SoapHttpClientProtocol.cs :
+         Don't use HTTP header when SoapVersion is Soap12.
+       * HttpSoapWebServiceHandler.cs :
+         With SOAP 1.2 message we can only use Body content.
+         Set correct Content-Type for SOAP 1.2 message.
+       * Fault12.cs : added null check.
+       * SoapClientMessage.cs :
+         Set correct Content-Type for SOAP 1.2 message.
+       * WebServiceHandlerFactory.cs :
+         don't reject SOAP 1.2 protocol here.
+
 2006-12-18  Atsushi Enomoto  <atsushi@ximian.com>
 
        * WebServiceHandlerFactory.cs,
index a430d931dd368042302266fce82edbd7f080c601..5e70b6cd57ff1fbb7deeb2ad011a8cc1993ed1df 100644 (file)
@@ -75,7 +75,8 @@ namespace System.Web.Services.Protocols
                {
                        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 @@ namespace System.Web.Services.Protocols
 
                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 e113626c012eff5d6107cdc607b1d427d9274457..b2b6de0c0d865c1981d73c5ad7835f7316915992 100644 (file)
@@ -143,7 +143,12 @@ namespace System.Web.Services.Protocols
                                // If the routing style is SoapAction, then we can get the method information now
                                // and set it to the SoapMessage
 
+#if NET_2_0
+                               if (_typeStubInfo.RoutingStyle == SoapServiceRoutingStyle.SoapAction &&
+                                       message.SoapVersion != SoapProtocolVersion.Soap12)
+#else
                                if (_typeStubInfo.RoutingStyle == SoapServiceRoutingStyle.SoapAction)
+#endif
                                {
                                        soapAction = request.Headers ["SOAPAction"];
                                        if (soapAction == null) throw new SoapException ("Missing SOAPAction header", SoapException.ClientFaultCode);
@@ -163,7 +168,12 @@ namespace System.Web.Services.Protocols
                                // If the routing style is RequestElement, try to get the method name from the
                                // stream processed by the high priority extensions
 
+#if NET_2_0
+                               if (_typeStubInfo.RoutingStyle == SoapServiceRoutingStyle.RequestElement ||
+                                    message.SoapVersion == SoapProtocolVersion.Soap12)
+#else
                                if (_typeStubInfo.RoutingStyle == SoapServiceRoutingStyle.RequestElement)
+#endif
                                {
                                        MemoryStream mstream;
                                        byte[] buffer = null;
@@ -272,7 +282,13 @@ namespace System.Web.Services.Protocols
                        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 cd0b1ff24167be2fd3beec35cfbda134908da02f..8ef0fb4d8a99ec5226a1732670a31632c42f8d51 100644 (file)
@@ -59,6 +59,8 @@ namespace System.Web.Services.Protocols {
                        this.client = client;
                        this.url = url;
                        Parameters = parameters;
+                       if (SoapVersion == SoapProtocolVersion.Soap12)
+                               ContentType = "application/soap+xml";
                }
 
                #endregion 
index 6630a1f36179fc1506ea9d339afab32717dbfe3a..19b41e1351ec7b9a6c6dcafab3bace2c373cf62d 100644 (file)
@@ -202,7 +202,12 @@ namespace System.Web.Services.Protocols
                        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;
                }
index 36715ebb600e75bcf4f48bc6ed7bff0171f8be87..2baaa98ede40965794679a39822c5937de5ef4ad 100644 (file)
@@ -113,6 +113,7 @@ namespace System.Web.Services.Protocols
                        supported = WSConfig.IsSupported (protocol);
                        if (!supported) {
                                switch (protocol) {
+                                       case WSProtocol.HttpSoap12:
                                        case WSProtocol.HttpSoap:
                                                supported = WSConfig.IsSupported (WSProtocol.HttpSoap12);
                                                break;
@@ -131,6 +132,7 @@ namespace System.Web.Services.Protocols
                                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 @@ namespace System.Web.Services.Protocols
                                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
                        {