title: java.lang.ClassCastException: javax.xml.bind.JAXBElement cannot be cast to
body: <p>I am using Spring boot to call a webservice. </p>
  
  <p>my config class is as: </p>
  
  <pre><code>@Configuration
  public class ClientAppConfig {
  @Bean
  public Jaxb2Marshaller marshaller() {
      Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
      marshaller.setPackagesToScan("com.client.stub");
      return marshaller;
  }
  
  @Bean
  public ARTestClient arTestClient(Jaxb2Marshaller marshaller) {
      ARTestClient client = new ARTestClient();
      client.setDefaultUri("uri");
      client.setMarshaller(marshaller);
      client.setUnmarshaller(marshaller);
     return client;
  }
  </code></pre>
  
  <p>i am calling service as following: </p>
  
  <pre><code>    OutputMessageType response = (OutputMessageType) getWebServiceTemplate().marshalSendAndReceive(
              inputMessageType, new SoapActionCallback("http://Serviceuri"));
  </code></pre>
  
  <p>I am getting following error: </p>
  
  <pre><code>   [2016-03-18 14:45:43.697] boot - 10272 ERROR [http-nio-8080-exec-1] --- [dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception 
    [Request processing failed; nested exception is java.lang.ClassCastException: javax.xml.bind.JAXBElement 
    cannot be cast to com.wfs.client.stub.ar.OutputMessageType] with root cause
  </code></pre>
  
  <p>How to unMarshal the output from webservice????? 
  How do i set unmarshaller for the response?? </p>