Was looking for an answer myself, but don't know about the java binding or whatever the code pasted above was. I'm using the python bindings on version 1.9.20 this is what worked for me.
tls = testlink.TestLinkHelper().connect(testlink.TestlinkAPIClient)
projects = tls.getProjects()
suiteroots = tls.getFirstLevelTestSuitesForTestProject(projects['id'])
for tlsuite in suiteroots:
for cases in tls.getTestCasesForTestSuite(testsuiteid=tlsuite['id'], deep=4, details='*'):
test_case = tls.getTestCase(testcaseid=cases['id']) # curiously this is always an array of 1 elements
Note how getTestCase() returns a list even when you expect only one object , I think in the wild this may well be returning all versions of the test-case? But the version of a test is not a concern for me now.