title: Spring Soap WebService + JaxB Marshallar : Fields are missing from soap response xml
body: <p>I created a Spring 3.0 webservice using soap and jaxb2marshaller for marshaling xml. I'm deploying it in wildfly server. once deployed for the first 15-20 mins all the fields specified in the response pojo is populated in the response xml. but after 15 mins all the requests made to the webservice contains responses with only one field.</p>
  
  <p>Spring-servlet.xml</p>
  
  <pre><code>&lt;bean id="MobileWebservice"
      class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition"&gt;
      &lt;constructor-arg value="/WEB-INF/wsdl/MobileWebservice.wsdl" /&gt;
  &lt;/bean&gt;
  
  &lt;bean
      class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter"&gt;
      &lt;description&gt;Enables the MessageDispatchServlet to invoke methods requiring OXM marshalling.&lt;/description&gt;
      &lt;constructor-arg ref="jaxb2Marshaller"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jaxb2Marshaller"
      class="org.springframework.oxm.jaxb.Jaxb2Marshaller" 
      scope="prototype"&gt;
      &lt;property name="contextPath"
          value="com.webservice.mobilewebservice.vo" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I'm generating pojo's from the wsdl file and the pojo in discussion looks like this.</p>
  
  <pre><code>//
  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
  // 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.11 at 12:10:59 PM IST 
  //
  
  
  package com.webservice.mobilewebservice.vo;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  import javax.xml.bind.annotation.XmlType;
  
  
  /**
   * &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="assessmentResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
   *         &amp;lt;element name="resultStatus" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
   *         &amp;lt;element name="resultMessage" type="{http://www.w3.org/2001/XMLSchema}string"/&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 = {
      "assessmentResult",
      "resultStatus",
      "resultMessage"
  })
  @XmlRootElement(name = "PerformAssessmentResponse")
  public class PerformAssessmentResponse {
  
      protected String assessmentResult;
      @XmlElement(required = true)
      protected String resultStatus;
      @XmlElement(required = true)
      protected String resultMessage;
  
      /**
       * Gets the value of the assessmentResult property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
      public String getAssessmentResult() {
          return assessmentResult;
      }
  
      /**
       * Sets the value of the assessmentResult property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setAssessmentResult(String value) {
          this.assessmentResult = value;
      }
  
      /**
       * Gets the value of the resultStatus property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
      public String getResultStatus() {
          return resultStatus;
      }
  
      /**
       * Sets the value of the resultStatus property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setResultStatus(String value) {
          this.resultStatus = value;
      }
  
      /**
       * Gets the value of the resultMessage property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
      public String getResultMessage() {
          return resultMessage;
      }
  
      /**
       * Sets the value of the resultMessage property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setResultMessage(String value) {
          this.resultMessage = value;
      }
  
  }
  </code></pre>
  
  <p>This is the modified file trying to fix the issue.</p>
  
  <pre><code>// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
  // 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.11 at 12:10:59 PM IST 
  //
  
  
  package com.webservice.mobilewebservice.vo;
  
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  import javax.xml.bind.annotation.XmlType;
  
  
  /**
   * &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="assessmentResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
   *         &amp;lt;element name="resultStatus" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
   *         &amp;lt;element name="resultMessage" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
   *       &amp;lt;/sequence&gt;
   *     &amp;lt;/restriction&gt;
   *   &amp;lt;/complexContent&gt;
   * &amp;lt;/complexType&gt;
   * &lt;/pre&gt;
   * 
   * 
   */
  @XmlType(name = "", propOrder = {
      "assessmentResult",
      "resultStatus",
      "resultMessage"
  })
  @XmlRootElement(name = "PerformAssessmentResponse")
  public class PerformAssessmentResponse {
  
  
      protected String assessmentResult;
      protected String resultStatus;
      protected String resultMessage;
  
      /**
       * Gets the value of the assessmentResult property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
      @XmlElement(required = false)
      public String getAssessmentResult() {
          return assessmentResult;
      }
  
      /**
       * Sets the value of the assessmentResult property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setAssessmentResult(String value) {
          this.assessmentResult = value;
      }
  
      /**
       * Gets the value of the resultStatus property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
  
      @XmlElement(required = true)
      public String getResultStatus() {
          return resultStatus;
      }
  
      /**
       * Sets the value of the resultStatus property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setResultStatus(String value) {
          this.resultStatus = value;
      }
  
      /**
       * Gets the value of the resultMessage property.
       * 
       * @return
       *     possible object is
       *     {@link String }
       *     
       */
  
      @XmlElement(required = true)
      public String getResultMessage() {
          return resultMessage;
      }
  
      /**
       * Sets the value of the resultMessage property.
       * 
       * @param value
       *     allowed object is
       *     {@link String }
       *     
       */
      public void setResultMessage(String value) {
          this.resultMessage = value;
      }
  
      @Override
      public String toString() {
          return "PerformAssessmentResponse [assessmentResult=" + assessmentResult + ", resultStatus=" + resultStatus
                  + ", resultMessage=" + resultMessage + "]";
      }
  
  }
  </code></pre>
  
  <p>I tried using DefaultMethodEndpointAdapter but the result is same. i couldn't find any fix.</p>
  
  <p>Expeceted response.</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;SOAP-ENV:Body&gt;
        &lt;ns3:PerformAssessmentResponse xmlns:ns3="http://com.mobile.service/MobileWebservice/"&gt;
           &lt;assessmentResult&gt;true&lt;/assessmentResult&gt;
           &lt;resultStatus&gt;1&lt;/resultStatus&gt;
           &lt;resultMessage&gt;Success&lt;/resultMessage&gt;
        &lt;/ns3:PerformAssessmentResponse&gt;
     &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Actual Response:</p>
  
  <pre><code>    &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;SOAP-ENV:Body&gt;
        &lt;ns3:PerformAssessmentResponse xmlns:ns3="http://com.mobile.service/MobileWebservice/"&gt;
           &lt;resultStatus&gt;1&lt;/resultStatus&gt;
        &lt;/ns3:PerformAssessmentResponse&gt;
     &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>MobileWebServiceEndpoint.java</p>
  
  <pre><code>    package com.webservice.mobilewebservice.endpoint;
  
  import java.io.ByteArrayInputStream;
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.util.Date;
  import java.util.GregorianCalendar;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import java.util.zip.ZipException;
  
  import javax.xml.datatype.DatatypeFactory;
  import javax.xml.datatype.XMLGregorianCalendar;
  
  import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
  import org.apache.commons.compress.archivers.zip.ZipFile;
  import org.apache.commons.io.IOUtils;
  import org.apache.commons.lang.StringUtils;
  import org.apache.log4j.Logger;
  import org.springframework.ws.server.endpoint.annotation.Endpoint;
  import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
  
  
  @Endpoint
  public class MobileWebServiceEndPoint {
  
      public static String INTERNAL_SERVER_ERROR_MESSAGE = "Internal Server Error";
      @PayloadRoot(localPart = "PerformAssessmentRequest", namespace = "http://com.mobile.service/MobileWebservice/")
      public PerformAssessmentResponse performAssessment(PerformAssessmentRequest request)
      {
          PerformAssessmentResponse response = new PerformAssessmentResponse();
          try
          {
              byte [] requestData = request.getRequestData();
              Map dataMap = new HashMap();
              dataMap.put("transactionId", request.getTransactionId());
              dataMap.put("requestData", requestData);
  
  
              response.setResultMessage("Success");
              response.setResultStatus("1");
  
              response.setAssessmentResult("true");
          }
          catch(Exception lre)
          {
              lre.printStackTrace();
              response.setResultStatus("500");
              response.setResultMessage(INTERNAL_SERVER_ERROR_MESSAGE);
          }
          return response;
      }
  </code></pre>
  
  <p>someone please suggest me a solution.</p>