Пример #1
0
        public static void QueryPutBinaryExt(SqlString uri, SqlString method, SqlNameValueCollection headersIn, SqlBytes bytesIn, out SqlNameValueCollection headersOut, ref SqlNameValueCollection attributes)
        {
            var request = Create(uri.IsNull ? default(String) : uri.Value, method.IsNull ? default(String) : method.Value, headersIn.IsNull ? null : headersIn.Value, attributes.IsNull ? null : attributes.Value);

            if (!bytesIn.IsNull)
            {
                PutBinary(request, bytesIn, attributes.IsNull ? null : attributes.Value);
            }
            WebResponse response;

            try
            {
                response = request.GetResponse();
            }
            catch (WebException ex)
            {
                response = ex.Response;
            }
            using (response)
            {
                headersOut = new SqlNameValueCollection(new NameValueCollection(response.Headers));
                if (attributes != null && !attributes.IsNull)
                {
                    GetProperties(response, attributes.Value, ResponsePrefix);
                }
            }
        }
Пример #2
0
        public static SqlChars QueryPutTextGetText(SqlString uri, SqlString method, SqlNameValueCollection headers, SqlChars chars, SqlNameValueCollection attributes)
        {
            if (uri.IsNull || method.IsNull)
            {
                return(SqlChars.Null);
            }

            var request = Create(uri.Value, method.Value, headers.IsNull ? null : headers.Value, attributes.IsNull ? null : attributes.Value);

            if (!chars.IsNull)
            {
                PutText(request, chars, attributes.IsNull ? null : attributes.Value);
            }
            WebResponse response;

            try
            {
                response = request.GetResponse();
            }
            catch (WebException ex)
            {
                response = ex.Response;
            }
            using (response)
                return(GetText(response, attributes.IsNull ? null : attributes.Value));
        }
Пример #3
0
        public static SqlXml QueryPutBinaryGetXml(SqlString uri, SqlString method, SqlNameValueCollection headers, SqlBytes bytes, SqlNameValueCollection attributes)
        {
            if (uri.IsNull || method.IsNull)
            {
                return(SqlXml.Null);
            }

            var request = Create(uri.Value, method.Value, headers.IsNull ? null : headers.Value, attributes.IsNull ? null : attributes.Value);

            if (!bytes.IsNull)
            {
                PutBinary(request, bytes, attributes.IsNull ? null : attributes.Value);
            }
            WebResponse response;

            try
            {
                response = request.GetResponse();
            }
            catch (WebException ex)
            {
                response = ex.Response;
            }
            using (response)
                return(GetXml(response, attributes.IsNull ? null : attributes.Value));
        }
Пример #4
0
        public static void QueryGetTextExt(SqlString uri, SqlString method, SqlNameValueCollection headersIn, out SqlNameValueCollection headersOut, out SqlChars charsOut, ref SqlNameValueCollection attributes)
        {
            var         request = Create(uri.IsNull ? default(String) : uri.Value, method.IsNull ? default(String) : method.Value, headersIn.IsNull ? null : headersIn.Value, attributes.IsNull ? null : attributes.Value);
            WebResponse response;

            try
            {
                response = request.GetResponse();
            }
            catch (WebException ex)
            {
                response = ex.Response;
            }
            using (response)
            {
                headersOut = new SqlNameValueCollection(new NameValueCollection(response.Headers));
                charsOut   = GetText(response, attributes.IsNull ? null : attributes.Value);
            }
        }
Пример #5
0
        public static SqlNameValueCollection QueryPutBinary(SqlString uri, SqlString method, SqlNameValueCollection headers, SqlBytes bytes, SqlNameValueCollection attributes)
        {
            if (uri.IsNull || method.IsNull)
            {
                return(SqlNameValueCollection.Null);
            }

            var request = Create(uri.Value, method.Value, headers.IsNull ? null : headers.Value, attributes.IsNull ? null : attributes.Value);

            if (!bytes.IsNull)
            {
                PutBinary(request, bytes, attributes.IsNull ? null : attributes.Value);
            }
            WebResponse response;

            try
            {
                response = request.GetResponse();
            }
            catch (WebException ex)
            {
                response = ex.Response;
            }
            using (response)
                if (attributes != null && !attributes.IsNull)
                {
                    GetProperties(response, attributes.Value, ResponsePrefix);
                }
            return(attributes);
        }