title: Unmarshalling Error: unexpected element from legacy request with legacy WSDL
body: <p>I am receiving a SOAP request from some legacy code, and dealing with it using JAX-WS generated objects from the same WSDL the legacy code uses, but I am getting an Unmarshalling Error: unexpected element error when I process the request. </p>
  
  <p>The WSDL part for this request is as follows: (Please note "schema" has replaced all the actual schema locations for our WSDL)</p>
  
  <pre><code>    &lt;xsd:complexType name="Administrate"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:element name="AdminOperation" type="typens:AdminOperation" maxOccurs="unbounded" minOccurs="0"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
      &lt;xsd:element name="Administrate" type="typens:Administrate"/&gt;
      &lt;xsd:complexType name="AdministrateResponse"&gt;
          &lt;xsd:sequence&gt;
          &lt;xsd:element name="Status" type="typens:SoapResponseStatus"/&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
      &lt;xsd:element name="AdministrateResponse" type="typens:AdministrateResponse"/&gt;
      &lt;xsd:complexType name="AdminOperation"&gt;
          &lt;xsd:sequence&gt;
              &lt;xsd:choice&gt;
                  &lt;xsd:element name="Transaction" type="typens:Transaction" minOccurs="0"/&gt;
                  &lt;xsd:element name="CreateUser" type="typens:CreateUser" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteUser" type="typens:DeleteUser" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateUser" type="typens:UpdateUser" minOccurs="0"/&gt;
                  &lt;xsd:element name="CreateGroup" type="typens:CreateGroup" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteGroup" type="typens:DeleteGroup" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateGroup" type="typens:UpdateGroup" minOccurs="0"/&gt;
                  &lt;xsd:element name="CreateChannel" type="typens:CreateChannel" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteChannel" type="typens:DeleteChannel" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateChannel" type="typens:UpdateChannel" minOccurs="0"/&gt;
                  &lt;xsd:element name="CreateRole" type="typens:CreateRole" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteRole" type="typens:DeleteRole" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateRole" type="typens:UpdateRole" minOccurs="0"/&gt;
                  &lt;xsd:element name="CreateFileType" type="typens:CreateFileType" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteFileType" type="typens:DeleteFileType" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateFileType" type="typens:UpdateFileType" minOccurs="0"/&gt;
                  &lt;xsd:element name="CreateFolder" type="typens:CreateFolder" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteFile" type="typens:DeleteFile" minOccurs="0"/&gt;
                  &lt;xsd:element name="MoveFile" type="typens:MoveFile" minOccurs="0"/&gt;
                  &lt;xsd:element name="CopyFile" type="typens:CopyFile" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateFile" type="typens:UpdateFile" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteJob" type="typens:DeleteJob" minOccurs="0"/&gt;
                  &lt;xsd:element name="DeleteJobNotices" type="typens:DeleteJobNotices" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateJobSchedule" type="typens:UpdateJobSchedule" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateVolumeProperties" type="typens:UpdateVolumeProperties" minOccurs="0"/&gt;
                  &lt;xsd:element name="UpdateOpenSecurityCache" type="typens:UpdateOpenSecurityCache" minOccurs="0"/&gt;
              &lt;/xsd:choice&gt;
          &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
  </code></pre>
  
  <p>and the request sent:</p>
  
  <pre><code>    &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
          SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" xmlns="schema"&gt;
          &lt;SOAP-ENV:Header&gt;
              &lt;AuthId&gt;7&lt;/AuthId&gt;
          &lt;/SOAP-ENV:Header&gt;
          &lt;SOAP-ENV:Body&gt;
              &lt;Administrate&gt;
                  &lt;UpdateFile&gt;
                      &lt;SetPermissions&gt;
                          &lt;Permission SOAP-ENC:arrayType="Permission[1]"&gt;
                              &lt;UserName&gt;username&lt;/UserName&gt;
                              &lt;AccessRight&gt;rights&lt;/AccessRight&gt;
                          &lt;/Permission&gt;
                      &lt;/SetPermissions&gt;
                      &lt;NameList&gt;
                          &lt;String&gt;folder1&lt;/String&gt;
                          &lt;String&gt;folder1/folder2&lt;/String&gt;
                          &lt;String&gt;folder1/folder2/file.ext&lt;/String&gt;
                      &lt;/NameList&gt;
                  &lt;/UpdateFile&gt;
              &lt;/Administrate&gt;
          &lt;/SOAP-ENV:Body&gt;
      &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>But I get the following error from my code:</p>
  
  <pre><code>            &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
                  &lt;soap:Body&gt;
                      &lt;soap:Fault&gt;
                          &lt;faultcode&gt;soap:Client&lt;/faultcode&gt;
                          &lt;faultstring&gt;Unmarshalling Error: unexpected element
                              (uri:"schema", local:"UpdateFile"). Expected elements
                              are &amp;lt;{schema}AdminOperation&gt; &lt;/faultstring&gt;
                      &lt;/soap:Fault&gt;
                  &lt;/soap:Body&gt;
              &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>The Administrate JAX-WS generated object just contains an ArrayList of AdminOperations with a getter, </p>
  
  <pre><code>    @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType(name = "Administrate", propOrder = {
          "adminOperation"
      })
      public class Administrate {
  
          @XmlElement(name = "AdminOperation")
          protected List&lt;AdminOperation&gt; adminOperation;
  
          /**
           * Gets the value of the adminOperation property.
           * 
           * &lt;p&gt;
           * This accessor method returns a reference to the live list,
           * not a snapshot. Therefore any modification you make to the
           * returned list will be present inside the JAXB object.
           * This is why there is not a &lt;CODE&gt;set&lt;/CODE&gt; method for the adminOperation property.
           * 
           * &lt;p&gt;
           * For example, to add a new item, do as follows:
           * &lt;pre&gt;
           *    getAdminOperation().add(newItem);
           * &lt;/pre&gt;
           * 
           * 
           * &lt;p&gt;
           * Objects of the following type(s) are allowed in the list
           * {@link AdminOperation }
           * 
           * 
           */
          public List&lt;AdminOperation&gt; getAdminOperation() {
              if (adminOperation == null) {
                  adminOperation = new ArrayList&lt;AdminOperation&gt;();
              }
              return this.adminOperation;
          }
  
      }
  </code></pre>
  
  <p>But judging from the legacy request sent and from the WSDL, this operation tag is replaced with choice of operations, e.g. updatefile etc right?</p>
  
  <p>As I cannot change the legacy request or legacy WSDL, I am unsure as to how to proceed. Any help would be greatly appreciated, so thanks in advance!</p>