title: JAXB cannot handle an interface - what am I missing?
body: <p>I'm getting familiar with web services in Java using Jax-ws (or JAXB, not sure, anyway...).</p>
  
  <p>I've created small project with a single webservice. The WS has the only endpoint called transfer and returns objects inheriting ITransferResult interface.</p>
  
  <p><strong>Web service contract</strong></p>
  
  <pre><code>//Service Endpoint Interface
  @WebService
  @SOAPBinding(style = Style.RPC)
  public interface IBankWebSrv {
      @WebMethod
      ITransferResult transfer(String accountNumber, double amount);
  }
  </code></pre>
  
  <p><strong>Web service implementation</strong></p>
  
  <pre><code>//Service Implementation
  @WebService(endpointInterface = "Contracts.IBankWebSrv")
  public class BankWebSrv implements IBankWebSrv {
      @Override
      public ITransferResult transfer(String accountNumber, double amount) {
          ITransferResult result = new TransferResult();
          // TODO logic here
          result.setSuccessful(true);
          return result;
      }
  }
  </code></pre>
  
  <p><strong>TransferResult contract</strong></p>
  
  <pre><code>@XmlJavaTypeAdapter(TransferResult.class)
  public interface ITransferResult {
      boolean isSuccessful();
      void setSuccessful(boolean successful);
  }
  </code></pre>
  
  <p><strong>TransferResult implementation</strong></p>
  
  <pre><code>public class TransferResult extends XmlAdapter&lt;TransferResult, ITransferResult&gt;
          implements ITransferResult {
  
      @XmlElement
      boolean successful;
  
      public boolean isSuccessful() {
          return this.successful;
      }
  
      public void setSuccessful(boolean successful) {
          this.successful = successful;
      }
  
      @Override
      public TransferResult marshal(ITransferResult v) throws Exception {
          return (TransferResult) v;
      }
  
      @Override
      public ITransferResult unmarshal(TransferResult v) throws Exception {
          return (ITransferResult) v;
      }
  }
  </code></pre>
  
  <p>When I publish my web service, I get the following error:</p>
  
  <blockquote>
    <p>Exception in thread "main" javax.xml.ws.WebServiceException: Unable to
    create JAXBContext...</p>
    
    <p>Caused by: java.security.PrivilegedActionException:
    com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1
    counts of IllegalAnnotationExceptions <strong>ITransferResult is an interface,
    and JAXB can't handle interfaces.</strong>   this problem is related to the
    following location:       at ITransferResult</p>
  </blockquote>
  
  <p>I've looked over SO for the answer and applied to the most repetitive tips, but none of them have worked for me yet.</p>
  
  <p>What am I missing?</p>