Exemple #1
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);
    }