Skip to content
Mark Lesswing edited this page Mar 7, 2017 · 2 revisions

Frequenty-Asked Questions & Common Issues

Q: I know a field is available, but searching for it returns an "Invalid Argument" error''' A: Prior to the 1.1.10 release, libRETS defaults to using StandardNames. Many, if not most, servers do not properly implement Standard Names per the RETS specification. You can disable Standard Names by calling the StandardNames method on the SearchRequest object: searchRequest.SetStandardNames(false);

Q: In VB.NET or C#, I get a "px!=0" unhandled exception when trying to run or debug. A: There are two common ways this can happen: You do not have the librets-pinvoke.dll library in your compiled output directory. The easiest way to resolve this (permanently) is to include the librets-pinvoke.dll in your Project as a content item. Using Visual Studio .NET, follow these steps: Right-Click on your Project in the Solution Explorer, and choose "Add -> Existing Item..." Change the file type to "Executable", then browse to librets-pinvoke.dll, select it, and click OK. The DLL should now appear in your project. Select the librets-pinvoke.dll in your project and verify that its "Build Action" is set to "Content", and the "Copy to Output Directory" is set to "Copy if newer". You are trying to create objects or call methods before (successfully) authenticating. The (boolean) return value from RETSSession.Login will return true when successful.

Q: I am trying to log in to a Rapattoni server and need to set the HTTP User Agent. Even though I have it set, I can't seem to authenticate. A: You must set the User Agent before logging in to the server: librets.RetsSession rsession = new librets.RetsSession("loginURL"); rsession.SetUserAgent("MyUserAgent"); rsession.Login("username","password");

Q: How can I use User Agent authentication to access an Interealty server? A: You must set the User Agent and a User Agent Password before calling the Login method: librets.RetsSession rsession = new librets.RetsSession("loginURL"); rsession.SetUserAgent("MyUserAgent"); rsession.SetUserAgentAuthType(USER_AGENT_AUTH_INTEREALTY); rsession.SetUserAgentPassword("UAPassword"); rsession.Login("username","password");

Q: What does "XML parse error at 15:200: not well-formed (invalid token)" mean? A: There are a number of potential causes for this: The usual suspect is that extended characters are being returned by the server when the standard says it should be US-ASCII. In order to work around this, use the API: RetsSession::SetDefaultEncoding. See: http://www.crt.realtors.org/projects/rets/librets/documentation/api/classlibrets_1_1_rets_session.html. As of Version 1.3.2, the default encoding is ISO, so this should no longer be an issue. The second possibility is that two separate RETS transactions are done concurrently in releases prior to 1.3.0 (resolved as Ticket #73 in 1.3.0b1). The last possibility can be things like the dropping of the connection before it has been completed. This can be the result of networking issues or network timeouts for long-lived transactions. What does "XML parse error at 41:14: no element found" mean? This is usually the result of trying to create a looping construct that fetches a listing and then within that outer loop and query, trying to perform additional searches or fetch media for that listing: SearchResultSetAPtr results = session->Search(searchRequest.get()); while (results->HasNext()) { GetObjectRequest getObjectRequest(resource, type); getObjectRequest.AddAllObjects(results->GetString(keyField));

        GetObjectResponseAPtr   getObjectResponse = session->GetObject(&getObjectRequest);
        
        ObjectDescriptor * objectDescriptor;
        while ((objectDescriptor = getObjectResponse->NextObject()))
        {
             < process the media >
        }
    }

We strongly recommend that you do something like the following: std::vectorstd::string listings; SearchResultSetAPtr results = session->Search(searchRequest.get()); while (results->HasNext()) { listings.push_back(results->GetString(keyField)); } for (std::vectorstd::string::iterator i = listings.begin(); i != listings.end(); i++) { GetObjectRequest getObjectRequest(resource, type); getObjectRequest.AddAllObjects(*i);

        GetObjectResponseAPtr   getObjectResponse = session->GetObject(&getObjectRequest);
        
        ObjectDescriptor * objectDescriptor;
        while ((objectDescriptor = getObjectResponse->NextObject()))
        {
             < process the media >
        }
    }

Q: I'm building a native application to work with libRETS. What libraries are needed in order to link against libRETS? A: The minimum libraries required are: -llibrets -lcurl -lboost_filesystem -lexpat -lz If you are using the SQL to DMQL compiler, you will also need: -lantlr More recent versions of the Boost libraries will also need: -lboost_system

Q: My session appears to hang while fetching media. What's up with that? A: There are some servers out there that don't properly support the "Expect: 100 Continue" header during the HTTP POST. As a result, libRETS sits and waits for the server to send a "100 Continue" message before proceeding, and that message never arrives. As of libRETS version 1.2.4 there is a mode flag that disables that feature: RetsSession::SetModeFlags(RetsSession::MODE_NO_EXPECT)

Q: I still see funny characters in my output after switching to ISO encoding. Why? A: The most common reason for this is Microsoft's Windows-1252 character encoding. It is not strictly Latin 1 and certain UTF-8 characters are improperly rendered. This normally can be determined if you see the "Euro" sign in the output as the Euro sign is not a part of Latin 1. This is not an issue with libRETS itself, but the underlying source data and the character encoding you have selected for your workstation.

Q: When using the DOTNET DLL, I get the following exception: A: Unhandled Exception: System.TypeInitializationException: The type initializer for 'librets.RetsSession' threw an exception. ---> System.TypeInitializationException: The type initializer for 'librets.libretsPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) libRETS for Windows is released as a 32 bit DLL. This exception is most commonly the result of trying to build a 64 bit application and binding to the 32 bit DLL. See: http://mail.crt.realtors.org/pipermail/librets-users/2008-September/001391.html for a reference.

Q: Why is it on some servers I can not get the first media object when multiple objects are returned? A: This has to do with a malformed response by certain servers. According to RFC 2046, Section 5.1.1: The boundary delimiter MUST occur at the beginning of a line, i.e., following a CRLF, and the initial CRLF is considered to be attached to the boundary delimiter line rather than part of the preceding part. That strongly says that the initial boundary should be "--simple boundary". Some severs fail to send the initial while all other boundaries do include it. Hence, libRETS will locate the second boundary and consider it the first one found. Try enabling SetIgnoreMalformedHeaders(true) in the GetObject request. See: http://www.crt.realtors.org/projects/rets/librets/documentation/api/classlibrets_1_1_get_object_request.html

Q: I have Python/Ruby/?... installed on my machine. Why can't I build the SWIG bindings for these languages? A: If you are using the prebuilt package manager on your platform of choice, please note that in some instances, these environments have been broken into a "run-time" and "developer" versions. In most instances, only the run-time version gets installed. In order to build the SWIG bindings, you must also have the developer's (or the full) version installed.