title: How to unmarshall XML code containing @XmlAnyElement and DIFFGR
body: <p>I am trying to handle soap response from a webservice. I have used wsimport tool to generate client class for handling soap response. Below are the sample soap response and java handler.</p>
  
  <p>Soap Response :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;DataSet xmlns="http://tempuri.org/"&gt;
    &lt;xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"&gt;
      &lt;xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
            &lt;xs:element name="NTIS"&gt;
              &lt;xs:complexType&gt;
                &lt;xs:sequence&gt;
                  &lt;xs:element name="Error" type="xs:string" minOccurs="0"/&gt;
                &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
            &lt;/xs:element&gt;
          &lt;/xs:choice&gt;
        &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
    &lt;/xs:schema&gt;
    &lt;diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"&gt;
      &lt;NewDataSet xmlns=""&gt;
        &lt;NTIS diffgr:id="NTIS1" msdata:rowOrder="0" diffgr:hasChanges="inserted"&gt;
          &lt;Error&gt;UserName and/or Password are invalid.&lt;/Error&gt;
        &lt;/NTIS&gt;
      &lt;/NewDataSet&gt;
    &lt;/diffgr:diffgram&gt;
  &lt;/DataSet&gt;
  </code></pre>
  
  <p>Java handler class</p>
  
  <pre><code>package org.tempuri;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlAnyElement;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  import javax.xml.bind.annotation.XmlType;
  import org.w3._2001.xmlschema.Schema;
  
  
  /**
   * &lt;p&gt;Java class for anonymous complex type.
   * 
   * &lt;p&gt;The following schema fragment specifies the expected content contained within this class.
   * 
   * &lt;pre&gt;
   * &amp;lt;complexType&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="GetQueryNewResult" minOccurs="0"&gt;
   *           &amp;lt;complexType&gt;
   *             &amp;lt;complexContent&gt;
   *               &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
   *                 &amp;lt;sequence&gt;
   *                   &amp;lt;element ref="{http://www.w3.org/2001/XMLSchema}schema"/&gt;
   *                   &amp;lt;any/&gt;
   *                 &amp;lt;/sequence&gt;
   *               &amp;lt;/restriction&gt;
   *             &amp;lt;/complexContent&gt;
   *           &amp;lt;/complexType&gt;
   *         &amp;lt;/element&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 = "", propOrder = {
      "getQueryNewResult"
  })
  @XmlRootElement(name = "GetQueryNewResponse")
  public class GetQueryNewResponse {
  
      @XmlElement(name = "GetQueryNewResult")
      protected GetQueryNewResponse.GetQueryNewResult getQueryNewResult;
  
      /**
       * Gets the value of the getQueryNewResult property.
       * 
       * @return
       *     possible object is
       *     {@link GetQueryNewResponse.GetQueryNewResult }
       *     
       */
      public GetQueryNewResponse.GetQueryNewResult getGetQueryNewResult() {
          return getQueryNewResult;
      }
  
      /**
       * Sets the value of the getQueryNewResult property.
       * 
       * @param value
       *     allowed object is
       *     {@link GetQueryNewResponse.GetQueryNewResult }
       *     
       */
      public void setGetQueryNewResult(GetQueryNewResponse.GetQueryNewResult value) {
          this.getQueryNewResult = value;
      }
  
  
      /**
       * &lt;p&gt;Java class for anonymous complex type.
       * 
       * &lt;p&gt;The following schema fragment specifies the expected content contained within this class.
       * 
       * &lt;pre&gt;
       * &amp;lt;complexType&gt;
       *   &amp;lt;complexContent&gt;
       *     &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
       *       &amp;lt;sequence&gt;
       *         &amp;lt;element ref="{http://www.w3.org/2001/XMLSchema}schema"/&gt;
       *         &amp;lt;any/&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 = "", propOrder = {
          "schema",
          "any"
      })
      public static class GetQueryNewResult {
  
          @XmlElement(namespace = "http://www.w3.org/2001/XMLSchema", required = true)
          protected Schema schema;
          @XmlAnyElement(lax = true)
          protected Object any;
  
          /**
           * Gets the value of the schema property.
           * 
           * @return
           *     possible object is
           *     {@link Schema }
           *     
           */
          public Schema getSchema() {
              return schema;
          }
  
          /**
           * Sets the value of the schema property.
           * 
           * @param value
           *     allowed object is
           *     {@link Schema }
           *     
           */
          public void setSchema(Schema value) {
              this.schema = value;
          }
  
          /**
           * Gets the value of the any property.
           * 
           * @return
           *     possible object is
           *     {@link Object }
           *     
           */
          public Object getAny() {
              return any;
          }
  
          /**
           * Sets the value of the any property.
           * 
           * @param value
           *     allowed object is
           *     {@link Object }
           *     
           */
          public void setAny(Object value) {
              this.any = value;
          }
  
      }
  
  }
  </code></pre>
  
  <p>Client program :</p>
  
  <pre><code>package org.ritwik.client;
  
  import java.util.List;
  
  import javax.xml.bind.JAXBContext;
  import javax.xml.bind.JAXBException;
  import javax.xml.bind.Unmarshaller;
  import javax.xml.soap.Node;
  
  import org.tempuri.BACOnlineResponse;
  import org.tempuri.BACOnlineResponse.BACOnlineResult;
  import org.tempuri.BASCOnlineResponse;
  import org.tempuri.BASCOnlineResponse.BASCOnlineResult;
  import org.tempuri.DEAAppSearch;
  import org.tempuri.DEAAppSearchResponse;
  import org.tempuri.DEAAppSearchResponse.DEAAppSearchResult;
  import org.tempuri.Deawebsvc;
  import org.tempuri.DeawebsvcSoap;
  import org.tempuri.GetIssueDate;
  import org.tempuri.GetIssueDateResponse;
  import org.tempuri.GetQueryResponse;
  import org.tempuri.GetUserInfoResponse;
  import org.tempuri.GetUserInfoResponse.GetUserInfoResult;
  import org.tempuri.IsUserValidResponse;
  import org.tempuri.ObjectFactory;
  import org.w3c.dom.Element;
  
  public class WsClient {
  
          /**
           * @param args
           * @throws JAXBException 
           */
          public static void main(String[] args)  {
              // TODO Auto-generated method stub
  
              Deawebsvc deaw=new Deawebsvc();
              DeawebsvcSoap impl=deaw.getDeawebsvcSoap();
              ObjectFactory of=new ObjectFactory();   
              DEAAppSearchResponse dsSearch=of.createDEAAppSearchResponse();
              dsSearch.setDEAAppSearchResult(impl.deaAppSearch("deatest@ritwik.com"," deavalidation", "dea", "bac", "basc", "expirationFrom", "expirationTo", "company", "zip", "state", "pi", "maxRows"));
              System.out.println(dsSearch.getDEAAppSearchResult().toString());
              System.out.println(dsSearch.getDEAAppSearchResult().getAny());
  
  
  
          }
  
      }
  </code></pre>
  
  <p>Now the problem is I am unable to handle Result conet from "getDEAAppSearchResult().getAny()". Please suggest how to handle the content or unmarshal this.</p>
  
  <p>org.tempuri.DEAAppSearchResponse$DEAAppSearchResult@7bc768
  [diffgr:diffgram: null]</p>