Sorry, I don't have an answer for you. I used the jsp below along with
the gdata libraries in my local resin configuration and it worked fine
retrieving my contacts. It didn't matter if I specified the xerces xml
parsers or not. It worked either way.
I would guess you have something mis-configured or otherwise
interfering, or perhaps one or more of the contacts you're retrieving
has some bizarre or non-standard character(s) that are throwing off
the xerces parser. My advice would be to try to boil it down to the
simplest possible test case (one contact, no hibernate, nothing else)
and then slowly start adding other code and features until it breaks.
<%...@page
import="
com.google.gdata.client.Query,
com.google.gdata.client.contacts.ContactsService,
com.google.gdata.data.contacts.ContactEntry,
com.google.gdata.data.contacts.ContactFeed,
com.google.gdata.util.AuthenticationException,
com.google.gdata.util.ServiceException,
java.net.URL,
java.util.List"
%>
<%
try {
out
.println(System.getProperty("javax.xml.parsers.DocumentBuilderFactory")
+"<br>");
out.println(System.getProperty("javax.xml.parsers.SAXParserFactory")
+"<br>");
out
.println(System.getProperty("javax.xml.transform.TransformerFactory")
+"<br><br>");
//Create a new Contacts service
ContactsService myService = new ContactsService("My Application");
myService.setUserCredentials("****INSERT_GOOGLE_USER_NAME*******",
"*******INSERT_GOOGLE_PASSWORD********");
//Get a list of all entries
URL metafeedUrl = new URL("http://www.google.com/m8/feeds/contacts/default/full
");
out.println("Getting Contacts entries...<br><br>");
//ContactFeed resultFeed = myService.getFeed(metafeedUrl,
ContactFeed.class);
Query myQuery = new Query(metafeedUrl);
myQuery.setMaxResults(5);
ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class);
List<ContactEntry> entries = resultFeed.getEntries();
for (int i=0; i < entries.size(); i++) {
ContactEntry entry = entries.get(i);
out.println(entry.getTitle().getPlainText()+"<br><br>");
}
out.println("Total Entries: "+entries.size());
} catch (Exception e) {
out.println("Exception: "+e.getMessage()+"<br>");
e.printStackTrace();
}
%>
On Jan 16, 2009, at 13:01, Todd Sowers wrote:
Rob -
Thank you so much. I can promise you we will not figure it out. We
are out of ideas. Any guidance you can provide would be very much
appreciated.
Thanks,
Todd Sowers
On Jan 16, 2009, at 3:54 PM, Rob Lockstone wrote:
I don't have time to look at it now, but will this weekend if you
don't figure it out.
Rob
On Jan 16, 2009, at 12:36, Todd Sowers wrote:
Rob -
There are no errors. When we call the function, we ask it to
return the result set count. In our case it should be 37.
However it returns 0.
The API we are using is the Google Contacts Data API (http://code.google.com/apis/contacts/docs/2.0/developers_guide_java.html
)
This is the test class which should return data. It returns
nothing.
import com.google.gdata.client.contacts.ContactsService;
import com.google.gdata.data.contacts.ContactEntry;
import com.google.gdata.data.contacts.ContactFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import com.google.gdata.client.Query;
import com.manmatch.Constants;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This is a test template
*/
public class Contacts {
public static void main(String[] args) {
Log log = LogFactory.getLog(Constants.PACKAGE);
try {
// Create a new Contacts service
ContactsService myService = new ContactsService("My
Application");
myService
.setUserCredentials
("****INSERT_GOOGLE_USER_NAME
*******","*******INSERT_GOOGLE_PASSWORD********");
// Get a list of all entries
URL metafeedUrl = new URL("http://www.google.com/m8/feeds/contacts/default/full
");
log.info("Getting Contacts entries...\n");
//ContactFeed resultFeed = myService.getFeed(metafeedUrl,
ContactFeed.class);
Query myQuery = new
com.google.gdata.client.Query(metafeedUrl);
myQuery.setMaxResults(5);
ContactFeed resultFeed = myService.query(myQuery,
ContactFeed.class);
List<ContactEntry> entries = resultFeed.getEntries();
for(int i=0; i<entries.size(); i++) {
ContactEntry entry = entries.get(i);
log.info("\t" + entry.getTitle().getPlainText());
}
log.info("\nTotal Entries: "+entries.size());
}
catch(AuthenticationException e) {
e.printStackTrace();
}
catch(MalformedURLException e) {
e.printStackTrace();
}
catch(ServiceException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}
}
}
If we run this class in Eclipse as a Java application, it returns
the contact data without issue.
Any help here would be greatly appreciated. Thanks again.
On Jan 16, 2009, at 3:19 PM, Rob Lockstone wrote:
What Google API requests are resulting in errors? And what are the
errors?
Rob
On Jan 16, 2009, at 10:13, Todd Sowers wrote:
Rob -
Yes we have tried using the Apache Xerces parser and it doesn't
work
The only time the Google API returns records is when we do not
include
the following:
<server>
...
<!-- Requires Apache's xerces.jar and xml-apis.jar libraries. -->
<system-property
javax
.xml
.parsers
.DocumentBuilderFactory
="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property
javax
.xml
.parsers
.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
<!-- Requires Apache's xalan.jar library. -->
<system-property
javax
.xml
.transform
.TransformerFactory
="org.apache.xalan.processor.TransformerFactoryImpl"/>
...
</server>
In this case, hibernate returns errors.
We just are at a lose as what to do. We absolutely need to use
Hibernate, most of our application is developed using it. By
including the fore mentioned tags Hibernate works fine, but the
Google
API returns nothing.
Todd
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest