unable to connect to Mailchimp services using java wrapper
- by Nagesh
I am using Java wrapper of mailchimp API for converting to inline CSS.
I downloaded the java wrapper and tried with method inlineCss();
I register with Mailchimp and got the Api key.
API Key: d5296efe2d4879e90d95b151804f8d30-us1
I am getting the below exception while calling the ping(apiKey) method.
Could you please provide me the solution to resolve this problem.
Exception in thread "main" com.nwire.mailchimp.MailChimpServiceException: Failed to read servers response: api.mailchimp.com
at com.nwire.mailchimp.MailChimpServiceFactory$ClientFactory$1.invoke(MailChimpServiceFactory.java:190)
at $Proxy0.ping(Unknown Source)
at com.nwire.mailchimp.test.InlineTest.initialize(InlineTest.java:44)
at com.nwire.mailchimp.test.InlineTest.run(InlineTest.java:36)
at com.nwire.mailchimp.test.InlineTest.main(InlineTest.java:23)
Below is the code I am using for connecting to Mailchimp.
public void initialize() {
mcServices = MailChimpServiceFactory.getMailChimpServices();
final String ping = mcServices.ping(apiKey);
if (IMailChimpServices.PING_SUCCESS.equals(ping)) {
logger.error("MailChimp connection pinged successfully");
} else {
logger.error("Failed to ping MailChimp, response: " + ping);
}
}
Regards,
Nagesh.