diff options
author | Konstantin Triger <kostat@mono-cvs.ximian.com> | 2007-01-24 19:13:34 +0300 |
---|---|---|
committer | Konstantin Triger <kostat@mono-cvs.ximian.com> | 2007-01-24 19:13:34 +0300 |
commit | 87ba3d44163615ba9a7b63c800b69bbbe5871980 (patch) | |
tree | 7f3e86c1bea70629c5b143ada7dbd7a76c1770cf /data | |
parent | eaf2e03b084ccb10e8e279690d2ba7733c639d10 (diff) |
added support for testing using POST requests
svn path=/trunk/mono/; revision=71604
Diffstat (limited to 'data')
-rwxr-xr-x | data/net_2_0/DefaultWsdlHelpGenerator.jvm.aspx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/data/net_2_0/DefaultWsdlHelpGenerator.jvm.aspx b/data/net_2_0/DefaultWsdlHelpGenerator.jvm.aspx index 7bc6e2293e6..46371e8f8fc 100755 --- a/data/net_2_0/DefaultWsdlHelpGenerator.jvm.aspx +++ b/data/net_2_0/DefaultWsdlHelpGenerator.jvm.aspx @@ -16,6 +16,7 @@ <%@ Import Namespace="System.Xml.Schema" %> <%@ Import Namespace="System.Web.Services" %> <%@ Import Namespace="System.Web.Services.Description" %> +<%@ Import Namespace="System.Web.Services.Configuration" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.Globalization" %> @@ -25,6 +26,7 @@ <%@ Import Namespace="System.CodeDom.Compiler" %> <%@ Import Namespace="Microsoft.CSharp" %> <%@ Import Namespace="Microsoft.VisualBasic" %> +<%@ Import Namespace="System.Text" %> <%@ Import Namespace="System.Text.RegularExpressions" %> <%@ Assembly name="System.Web.Services" %> <%@ Page debug="true" %> @@ -122,7 +124,10 @@ void BuildOperationInfo () CurrentOperationProtocols += (string) prots[n]; } - CurrentOperationSupportsTest = prots.Contains ("HttpGet") || prots.Contains ("HttpPost"); + WebServiceProtocols testProtocols = WebServiceProtocols.HttpGet | WebServiceProtocols.HttpPost; + if (Context.Request.IsLocal) + testProtocols |= WebServiceProtocols.HttpPostLocalhost; + CurrentOperationSupportsTest = (WebServicesSection.Current.EnabledProtocols & testProtocols) != 0; // Operation format OperationBinding obin = FindOperation (binding, CurrentOperationName); @@ -346,7 +351,19 @@ string GetTestResult () { string url = location + "/" + CurrentOperationName; Uri uri = new Uri (url); - WebRequest req = WebRequest.Create (url + ".invoke?" + qs); + WebRequest req; + if (CurrentOperationProtocols.IndexOf ("HttpGet") < 0) { + req = WebRequest.Create (url + ".invoke"); + req.Method="POST"; + if (!String.IsNullOrEmpty (qs)) { + byte [] postBuffer = Encoding.UTF8.GetBytes (qs); + req.ContentLength = postBuffer.Length; + using (Stream requestStream = req.GetRequestStream()) + requestStream.Write (postBuffer, 0, postBuffer.Length); + } + } + else + req = WebRequest.Create (url + ".invoke?" + qs); HttpCookieCollection cookies = Request.Cookies; int last = cookies.Count; if (last > 0) { |