public override DataType GetResponseDataType()
        {
            DataType result;

            try
            {
                this.GetResponseStream();
                Match match = WcfStream.contentTypeRegex.Match(this.responseContentType);
                if (!match.Success)
                {
                    throw new AdomdUnknownResponseException(XmlaSR.UnsupportedDataFormat(this.responseContentType), "");
                }
                DataType dataTypeFromString = DataTypes.GetDataTypeFromString(match.Groups["content_type"].Value);
                if (dataTypeFromString == DataType.Undetermined || dataTypeFromString == DataType.Unknown)
                {
                    throw new AdomdUnknownResponseException(XmlaSR.UnsupportedDataFormat(this.responseContentType), "");
                }
                result = dataTypeFromString;
            }
            catch (XmlaStreamException e)
            {
                XmlaClient.UlsWriterLogException(e);
                throw;
            }
            catch (Exception ex)
            {
                XmlaClient.UlsWriterLogException(ex);
                throw new XmlaStreamException(ex);
            }
            return(result);
        }
Esempio n. 2
0
        public override DataType GetResponseDataType()
        {
            DataType result;

            try
            {
                this.GetResponseStream();
                Match match = HttpStream.contentTypeRegex.Match(this.httpResponse.ContentType);
                if (!match.Success)
                {
                    throw new AdomdUnknownResponseException(XmlaSR.UnsupportedDataFormat(this.httpResponse.ContentType), "");
                }
                DataType dataTypeFromString = DataTypes.GetDataTypeFromString(match.Groups["content_type"].Value);
                if (dataTypeFromString == DataType.Undetermined || dataTypeFromString == DataType.Unknown)
                {
                    throw new AdomdUnknownResponseException(XmlaSR.UnsupportedDataFormat(this.httpResponse.ContentType), "");
                }
                result = dataTypeFromString;
            }
            catch (XmlaStreamException)
            {
                throw;
            }
            catch (IOException innerException)
            {
                throw new XmlaStreamException(innerException);
            }
            catch (WebException innerException2)
            {
                throw new XmlaStreamException(innerException2);
            }
            catch (ProtocolViolationException innerException3)
            {
                throw new XmlaStreamException(innerException3);
            }
            return(result);
        }
Esempio n. 3
0
        public override DataType GetResponseDataType()
        {
            DataType result;

            try
            {
                if (this.endOfStream)
                {
                    result = DataType.Undetermined;
                }
                else
                {
                    if (this.dimeReader == null)
                    {
                        this.dimeReader        = new DimeReader(this.bufferedStream);
                        this.dimeRecordForRead = this.dimeReader.ReadRecord();
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace = new StackTrace();
                            stackTrace.GetFrame(1).GetMethod();
                        }
                        this.DetermineNegotiatedOptions();
                    }
                    if (this.dimeRecordForRead == null)
                    {
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace2 = new StackTrace();
                            stackTrace2.GetFrame(1).GetMethod();
                        }
                        this.dimeReader.Close();
                        this.dimeReader  = null;
                        this.endOfStream = true;
                        result           = DataType.Undetermined;
                    }
                    else
                    {
                        DataType dataTypeFromString = DataTypes.GetDataTypeFromString(this.dimeRecordForRead.Type);
                        if (TcpStream.TRACESWITCH.TraceVerbose)
                        {
                            StackTrace stackTrace3 = new StackTrace();
                            stackTrace3.GetFrame(1).GetMethod();
                        }
                        if (dataTypeFromString == DataType.Unknown)
                        {
                            throw new AdomdUnknownResponseException(XmlaSR.Dime_DataTypeNotSupported(this.dimeRecordForRead.Type), "");
                        }
                        result = dataTypeFromString;
                    }
                }
            }
            catch (XmlaStreamException)
            {
                throw;
            }
            catch (IOException innerException)
            {
                throw new XmlaStreamException(innerException);
            }
            catch (SocketException innerException2)
            {
                throw new XmlaStreamException(innerException2);
            }
            return(result);
        }