title: JAXB - A message body writer for Java class was not found
body: <p>I am trying to interrogate a rest service, and I need to put some data.</p>
  
  <p>The code I want to use to make the call is the following:</p>
  
  <pre><code>WebResource resource = this.client.resource(url);
  DocumentIndexFields myDocumentIndexFields = (DocumentIndexFields) resource.type(MediaType.APPLICATION_XML_TYPE).put(DocumentIndexFields.class, documentIndexFields);
  </code></pre>
  
  <p>My resource representation is the following:</p>
  
  <pre><code>package myPackage;
  
  import java.util.ArrayList;
  import java.util.List;
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlSeeAlso;
  import javax.xml.bind.annotation.XmlType;
  
  
  /**
   * &lt;p&gt;Java class for DocumentIndexFields complex type.
   * 
   * &lt;p&gt;The following schema fragment specifies the expected content contained within this class.
   * 
   * &lt;pre&gt;
   * &amp;lt;complexType name="DocumentIndexFields"&gt;
   *   &amp;lt;complexContent&gt;
   *     &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
   *       &amp;lt;sequence&gt;
   *         &amp;lt;element name="Field" type="{http://dev.docuware.com/schema/public/services/platform}DocumentIndexField" maxOccurs="unbounded" minOccurs="0"/&gt;
   *       &amp;lt;/sequence&gt;
   *     &amp;lt;/restriction&gt;
   *   &amp;lt;/complexContent&gt;
   * &amp;lt;/complexType&gt;
   * &lt;/pre&gt;
   * 
   * 
   */
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "DocumentIndexFields", propOrder = {
      "field"
  })
  @XmlSeeAlso({
      UpdateIndexFieldsInfo.class
  })
  public class DocumentIndexFields {
  
      @XmlElement(name = "Field")
      protected List&lt;DocumentIndexField&gt; field;
  
      public List&lt;DocumentIndexField&gt; getField() {
          if (field == null) {
              field = new ArrayList&lt;DocumentIndexField&gt;();
          }
          return this.field;
      }
  
  }
  </code></pre>
  
  <p>When I execute the call I get the following error:</p>
  
  <pre><code>oct. 13, 2014 4:33:58 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl &lt;init&gt;
  Grave: The registered message body writers compatible with the MIME media type are:
  application/xml -&gt;
    com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App
    com.sun.jersey.core.impl.provider.entity.DocumentProvider
    com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
    com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
    com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App
  */* -&gt;
    com.sun.jersey.core.impl.provider.entity.FormProvider
    com.sun.jersey.core.impl.provider.entity.StringProvider
    com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
    com.sun.jersey.core.impl.provider.entity.FileProvider
    com.sun.jersey.core.impl.provider.entity.InputStreamProvider
    com.sun.jersey.core.impl.provider.entity.DataSourceProvider
    com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
    com.sun.jersey.core.impl.provider.entity.ReaderProvider
    com.sun.jersey.core.impl.provider.entity.DocumentProvider
    com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
    com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
    com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
    com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
  
  Exception: A message body writer for Java class myPackage.platform.DocumentIndexFields, and Java type class myPackage.platform.DocumentIndexFields, and MIME media type application/xml was not found
  </code></pre>
  
  <p>Where am I wrong?
  Thank you</p>