The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Problem marshalling API response using RestEasy

New Member

Problem marshalling API response using RestEasy

 Hi All,

I am trying to use the Constant Contact API from within Java. I am using RestEasy in combination with JAXB. I am able to send the request using ProxyFactory and I am trying to extract my JAXB Object by using content.getJAXBObject(ContactList.class);

My ContactList class is a JAXB annotated class, namespace is properly set. It has a bunch of elements and one attribute.When I try to access

my ContactList instance only the attribute is properly populated, all elements are still null. Any ideas why this seems to only partially unmarshall?

Here's my ContactList class:

@XmlRootElement(name = "ContactList", namespace = "{namespace}")


public class ContactList {


   public String id;


   @XmlElement  (name="Name")

   public String name;



Here's the Service that I am calling using ProxyFactory

public interface ContactListService {




  public Entry getListById(@PathParam("id") String id);



and here's the call to the proxy:

ContactListService  client = ProxyFactory.create(ContactListService

.class, API_BASE + contactListResource, clientExecutor);

Content content = client.getListById("2").getContent();

ContactList list = content.getJAXBObject(ContactList.class);

--> now is properly populated but

The returned XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<entry xmlns="">

<link href="{some link}" rel="edit"></link>

 <id>{some link}</id>

<title type="text">{some text}</title>



<name>{some text}</name>


<content type="application/vnd.ctct+xml">16:44:25.992

 <ContactList xmlns="{some namespace}" id="{some text}">



<ShortName> test</ShortName>




<id>{some text}</id>

<title type="text">{some text}</title>

<link href="lists"></link>

<link href="lists" rel="self"></link>


<name>{some text}</name>






Any help greatly appreciated!


Re: Problem marshalling API response using RestEasy

I spoke with David Berard on our AppConnect team who mentioned that you had resolved this issue on your own. If you are still running into any problems please let us know. With that being said, if you did want to post the solution you came up with so that other people can benefit from it as well, that would be much appreciated. Thanks!

David J

New Member

I was able to solve my issue

I was able to solve my issue by using @javax.xml.bind.annotation.XmlSchema(namespace = "", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)  in my file. 

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More