Beispiel #1
0
        static void Main(string[] args)
        {
            var loginUrl = "";
            var username = "";
            var password = "";
            var userAgent = "";

            using (var retsSession = new RetsSession(loginUrl))
            {
                if (!string.IsNullOrEmpty(userAgent))
                {
                    retsSession.SetUserAgent(userAgent);
                }
                retsSession.SetRetsVersion(RetsVersion.RETS_1_7_2);

                if (!retsSession.Login(username, password))
                {
                    throw new Exception("RETS login failed");
                }

                var loginResponse = retsSession.GetLoginResponse();

                // todo: inspect login response
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var loginUrl  = "https://some.rets.server.com/rets/login";
            var username  = "";
            var password  = "";
            var userAgent = "";

            using (var retsSession = new RetsSession(loginUrl))
            {
                var uri = new Uri(loginUrl);
                if (uri.Scheme == Uri.UriSchemeHttps)
                {
                    // ssl certificate work around - https://groups.google.com/forum/#!searchin/librets/ssl%7Csort:relevance/librets/g62O8pxsAcg/AXzlKi133TUJ
                    retsSession.SetModeFlags(RetsSession.MODE_NO_SSL_VERIFY);
                }

                if (!string.IsNullOrEmpty(userAgent))
                {
                    retsSession.SetUserAgent(userAgent);
                }
                retsSession.SetRetsVersion(RetsVersion.RETS_1_8_0);

                if (!retsSession.Login(username, password))
                {
                    throw new Exception("RETS login failed");
                }

                var loginResponse = retsSession.GetLoginResponse();

                // todo: inspect login response
            }
        }
Beispiel #3
0
    /**
     * Create a RetsSession and populate it with all the known options.
     */
    public RetsSession SessionFactory()
    {
        uint flags = 0;

        if (mRetsSession != null)
        {
            mRetsSession.Cleanup();
            mRetsSession = null;
        }
        mRetsSession = new RetsSession(mUrl);

        mRetsSession.SetDefaultEncoding(mEncoding);
        if (mHttpLog.Length > 0)
        {
            mRetsSession.SetHttpLogName(mHttpLog);
        }
        mRetsSession.SetLogEverything(mLogEverything);
        mRetsSession.SetRetsVersion(mRetsVersion);
        mRetsSession.SetUserAgent(mUA);
        mRetsSession.SetUserAgentAuthType(mUAAuth);
        if (mUAPass.Length > 0)
        {
            mRetsSession.SetUserAgentPassword(mUAPass);
        }

        if (mEnableCacheing)
        {
            flags |= RetsSession.MODE_CACHE;
        }

        if (mNoSSLVerify)
        {
            flags |= RetsSession.MODE_NO_SSL_VERIFY;
        }

        if (mDisableStreaming)
        {
            /*
             * Caching is required in non-streaming mode.
             */
            flags |= RetsSession.MODE_CACHE | RetsSession.MODE_NO_STREAM;
        }
        mRetsSession.SetModeFlags(flags);

        return(mRetsSession);
    }
Beispiel #4
0
    /**
     * Create a RetsSession and populate it with all the known options.
     */
    public RetsSession SessionFactory()
    {
        uint flags = 0;

        if (mRetsSession != null)
        {
            mRetsSession.Cleanup();
            mRetsSession = null;
        }
        mRetsSession = new RetsSession(mUrl);

        mRetsSession.SetDefaultEncoding(mEncoding);
        if (mHttpLog.Length > 0)
            mRetsSession.SetHttpLogName(mHttpLog);
        mRetsSession.SetLogEverything(mLogEverything);
        mRetsSession.SetRetsVersion(mRetsVersion);
        mRetsSession.SetUserAgent(mUA);
        mRetsSession.SetUserAgentAuthType(mUAAuth);
        if (mUAPass.Length > 0)
            mRetsSession.SetUserAgentPassword(mUAPass);

        if (mEnableCacheing)
          flags |= RetsSession.MODE_CACHE;

        if (mNoSSLVerify)
          flags |= RetsSession.MODE_NO_SSL_VERIFY;

        if (mDisableStreaming)
        {
            /*
             * Caching is required in non-streaming mode.
             */
            flags |= RetsSession.MODE_CACHE | RetsSession.MODE_NO_STREAM;
        }
        mRetsSession.SetModeFlags(flags);

        return mRetsSession;
    }