title: Unmarshalling Error: unexpected element (uri:url, local:"objectname"). Expected elements are <{}objectname>
body: <p>I'm using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of some wsdl files.</p>
  
  <p>Everything is okay now, but when I'm trying to use some of the generated classes, i got this unmarshalling error, altough I use the generated ObjectFactory classes.</p>
  
  <p>Some of the stack:</p>
  
  <pre><code>org.springframework.ws.soap.client.SoapFaultClientException: Unmarshalling Error: unexpected element (uri:"http://xxxxxxxxx", local:"customer"). Expected elements are &lt;{}customer&gt; 
      at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38)
      at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:826)
      at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:621)
      at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
      at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
      at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
      at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:373)
      at einvoice.service.CustomerService.createCustomer(CustomerService.java:40)
      at einvoice.controller.facturatie.FacturatieOverzichtController.handleRenderRequest(FacturatieOverzichtController.java:36)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  </code></pre>
  
  <p>And my class:</p>
  
  <pre><code>@Service
  public class CustomerService {
  
      @Autowired
      private WebServiceTemplate customerDaoTemplate;
  
      private ObjectFactory customerObjectFactory;
  
      public CustomerService() {
          customerObjectFactory = new ObjectFactory();    
      }
  
      public boolean createCustomer(Customer c)
      {
          System.out.println("CREATING CUSTOMER");
          einvoice.proxy.customerdaoservice.Customer customer = customerObjectFactory.createCustomer();
          customer.setConnectionURL("test");
          customer.setUid("testuid");
          customer.setName("KorneelTest");
  
          Create create = customerObjectFactory.createCreate();
          create.setCustomer(customer);
  
          try
          {
              customerDaoTemplate.marshalSendAndReceive(customerObjectFactory.createCreate(create));
              return true;
          }
          catch(Exception ex)
          {
              ex.printStackTrace();
              return false;
          }
      }
  </code></pre>
  
  <p>It's the createCustomer() method that shows this error.</p>
  
  <pre><code>The generated ObjectFactory class:
  
  //
  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 
  // See &lt;a href="http://java.sun.com/xml/jaxb"&gt;http://java.sun.com/xml/jaxb&lt;/a&gt; 
  // Any modifications to this file will be lost upon recompilation of the source schema. 
  // Generated on: 2014.09.12 at 12:04:04 PM CEST 
  //
  
  
  package einvoice.proxy.customerdaoservice;
  
  import javax.xml.bind.JAXBElement;
  import javax.xml.bind.annotation.XmlElementDecl;
  import javax.xml.bind.annotation.XmlRegistry;
  import javax.xml.namespace.QName;
  
  
  /**
   * This object contains factory methods for each 
   * Java content interface and Java element interface 
   * generated in the be.icredit.einvoice.proxy.customerdaoservice package. 
   * &lt;p&gt;An ObjectFactory allows you to programatically 
   * construct new instances of the Java representation 
   * for XML content. The Java representation of XML 
   * content can consist of schema derived interfaces 
   * and classes representing the binding of schema 
   * type definitions, element declarations and model 
   * groups.  Factory methods for each of these are 
   * provided in this class.
   * 
   */
  @XmlRegistry
  public class ObjectFactory {
  
      private final static QName _AbstractFilter_QNAME = new QName("http://xxxxxxx/", "abstractFilter");
      private final static QName _Customer_QNAME = new QName("http://xxxxxxx/", "customer");
      private final static QName _FindSingleResponse_QNAME = new QName("http://xxxxxxx/", "findSingleResponse");
      private final static QName _Create_QNAME = new QName("http://xxxxxxx/", "create");
      private final static QName _Find_QNAME = new QName("http://xxxxxxx/", "find");
      private final static QName _CreateResponse_QNAME = new QName("xxxxxxx/", "createResponse");
      private final static QName _FindResponse_QNAME = new QName("http://xxxxxxx/", "findResponse");
      private final static QName _UpdateResponse_QNAME = new QName("http://xxxxxxx/", "updateResponse");
      private final static QName _FindSingle_QNAME = new QName("http://xxxxxxx/", "findSingle");
      private final static QName _CustomerFilter_QNAME = new QName("http://xxxxxxx/", "customerFilter");
      private final static QName _Update_QNAME = new QName("http://xxxxxxx/", "update");
      private final static QName _AbstractEntity_QNAME = new QName("http://xxxxxxx/", "abstractEntity");
  
      /**
       * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: be.icredit.einvoice.proxy.customerdaoservice
       * 
       */
      public ObjectFactory() {
      }
  
      /**
       * Create an instance of {@link Update }
       * 
       */
      public Update createUpdate() {
          return new Update();
      }
  
      /**
       * Create an instance of {@link CustomerFilter }
       * 
       */
      public CustomerFilter createCustomerFilter() {
          return new CustomerFilter();
      }
  
      /**
       * Create an instance of {@link UpdateResponse }
       * 
       */
      public UpdateResponse createUpdateResponse() {
          return new UpdateResponse();
      }
  
      /**
       * Create an instance of {@link FindSingle }
       * 
       */
      public FindSingle createFindSingle() {
          return new FindSingle();
      }
  
      /**
       * Create an instance of {@link FindResponse }
       * 
       */
      public FindResponse createFindResponse() {
          return new FindResponse();
      }
  
      /**
       * Create an instance of {@link CreateResponse }
       * 
       */
      public CreateResponse createCreateResponse() {
          return new CreateResponse();
      }
  
      /**
       * Create an instance of {@link FindSingleResponse }
       * 
       */
      public FindSingleResponse createFindSingleResponse() {
          return new FindSingleResponse();
      }
  
      /**
       * Create an instance of {@link Customer }
       * 
       */
      public Customer createCustomer() {
          return new Customer();
      }
  
      /**
       * Create an instance of {@link Create }
       * 
       */
      public Create createCreate() {
          return new Create();
      }
  
      /**
       * Create an instance of {@link Find }
       * 
       */
      public Find createFind() {
          return new Find();
      }
  
      /**
       * Create an instance of {@link Pager }
       * 
       */
      public Pager createPager() {
          return new Pager();
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link AbstractFilter }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "abstractFilter")
      public JAXBElement&lt;AbstractFilter&gt; createAbstractFilter(AbstractFilter value) {
          return new JAXBElement&lt;AbstractFilter&gt;(_AbstractFilter_QNAME, AbstractFilter.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link Customer }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "customer")
      public JAXBElement&lt;Customer&gt; createCustomer(Customer value) {
          return new JAXBElement&lt;Customer&gt;(_Customer_QNAME, Customer.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link FindSingleResponse }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "findSingleResponse")
      public JAXBElement&lt;FindSingleResponse&gt; createFindSingleResponse(FindSingleResponse value) {
          return new JAXBElement&lt;FindSingleResponse&gt;(_FindSingleResponse_QNAME, FindSingleResponse.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link Create }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "create")
      public JAXBElement&lt;Create&gt; createCreate(Create value) {
          return new JAXBElement&lt;Create&gt;(_Create_QNAME, Create.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link Find }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "find")
      public JAXBElement&lt;Find&gt; createFind(Find value) {
          return new JAXBElement&lt;Find&gt;(_Find_QNAME, Find.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link CreateResponse }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "createResponse")
      public JAXBElement&lt;CreateResponse&gt; createCreateResponse(CreateResponse value) {
          return new JAXBElement&lt;CreateResponse&gt;(_CreateResponse_QNAME, CreateResponse.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link FindResponse }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "findResponse")
      public JAXBElement&lt;FindResponse&gt; createFindResponse(FindResponse value) {
          return new JAXBElement&lt;FindResponse&gt;(_FindResponse_QNAME, FindResponse.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link UpdateResponse }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "updateResponse")
      public JAXBElement&lt;UpdateResponse&gt; createUpdateResponse(UpdateResponse value) {
          return new JAXBElement&lt;UpdateResponse&gt;(_UpdateResponse_QNAME, UpdateResponse.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link FindSingle }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "findSingle")
      public JAXBElement&lt;FindSingle&gt; createFindSingle(FindSingle value) {
          return new JAXBElement&lt;FindSingle&gt;(_FindSingle_QNAME, FindSingle.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link CustomerFilter }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "customerFilter")
      public JAXBElement&lt;CustomerFilter&gt; createCustomerFilter(CustomerFilter value) {
          return new JAXBElement&lt;CustomerFilter&gt;(_CustomerFilter_QNAME, CustomerFilter.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link Update }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "update")
      public JAXBElement&lt;Update&gt; createUpdate(Update value) {
          return new JAXBElement&lt;Update&gt;(_Update_QNAME, Update.class, null, value);
      }
  
      /**
       * Create an instance of {@link JAXBElement }{@code &lt;}{@link AbstractEntity }{@code &gt;}}
       * 
       */
      @XmlElementDecl(namespace = "http://xxxxxxx/", name = "abstractEntity")
      public JAXBElement&lt;AbstractEntity&gt; createAbstractEntity(AbstractEntity value) {
          return new JAXBElement&lt;AbstractEntity&gt;(_AbstractEntity_QNAME, AbstractEntity.class, null, value);
      }
  
  }
  </code></pre>
  
  <p>The package-info.java class:</p>
  
  <pre><code>//
  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 
  // See &lt;a href="http://java.sun.com/xml/jaxb"&gt;http://java.sun.com/xml/jaxb&lt;/a&gt; 
  // Any modifications to this file will be lost upon recompilation of the source schema. 
  // Generated on: 2014.09.12 at 03:44:51 PM CEST 
  //
  
  @javax.xml.bind.annotation.XmlSchema(namespace = "http://xxxxxxx/")
  package einvoice.proxy.customerdaoservice;
  </code></pre>