title: How to configure Spring-WS to use JAXB Marshaller?
body: <p>Thankyou for help on this so far, i am updating question as i did not show all i needed to, with changes recomended shown. the soap output is still not what i wanted.</p>
  
  <p><strong>servlet.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:sws="http://www.springframework.org/schema/web-services"
      xmlns:oxm="http://www.springframework.org/schema/oxm"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
                          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                          http://www.springframework.org/schema/web-services
                          http://www.springframework.org/schema/web-services/web-services-2.0.xsd
                          http://www.springframework.org/schema/context 
                          http://www.springframework.org/schema/context/spring-context-3.0.xsd
                          http://www.springframework.org/schema/oxm 
                          http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd"
                          &gt;
  
  &lt;!--Enables @Endpoint and related Spring-WS annotations.--&gt;
  &lt;sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/&gt; 
  
  &lt;bean id="weatherService"
      class="au.test.weather.ws.WeatherServiceImpl" /&gt;
  
  &lt;bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema" 
      p:xsd = "classpath:au/test/weather/ws/schemas/Temperature.xsd"/&gt;
  
  &lt;oxm:jaxb2-marshaller id="marshaller" &gt;
      &lt;oxm:class-to-be-bound name="au.test.weather.ws.GetTemperaturesResponse"/&gt; 
      &lt;oxm:class-to-be-bound name="au.test.weather.ws.GetTemperaturesRequest"/&gt;
      &lt;oxm:class-to-be-bound name="au.test.weather.ws.schemas.Jaxb2Marshaller"/&gt;  
  &lt;/oxm:jaxb2-marshaller&gt; 
  
  &lt;bean id="temperatureEndpoint"
      class="au.test.weather.ws.TemperatureMarshallingEndpoint"&gt;
      &lt;property name="weatherService" ref="weatherService" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p><strong>what my annotated classes look like</strong></p>
  
  <pre><code>@XmlRootElement(name = "GetTemperaturesRequest")
  public class GetTemperaturesRequest {
  
      @XmlElement(required = true)
      protected String city;
      @XmlElement(required = true)
      @XmlSchemaType(name = "date")
      protected List&lt;XMLGregorianCalendar&gt; date;
  
      public String getCity() {
          return city;
      }
  
      public void setCity(String value) {
          this.city = value;
      }
  
      public List&lt;XMLGregorianCalendar&gt; getDate() {
          if (date == null) {
              date = new ArrayList&lt;XMLGregorianCalendar&gt;();
          }
          return this.date;
      }
  
      public void setDates(List&lt;XMLGregorianCalendar&gt; dates) {
  this.date = dates;  
      }
  }
  </code></pre>
  
  <p><strong>Endpoint</strong></p>
  
  <pre><code>@Endpoint
  public class TemperatureMarshallingEndpoint {
  
      private static final String namespaceUri = "http://test.au/schema/weather";
      public static final String request_local_name = "GetTemperaturesRequest";
      private WeatherService weatherService;
  
      public void setWeatherService(WeatherService weatherService) {
          this.weatherService = weatherService;
      }
  
      @PayloadRoot(localPart = request_local_name, namespace = namespaceUri)
      @ResponsePayload
      public GetTemperaturesResponse getTemperature(@RequestPayload GetTemperaturesRequest request) throws JAXBException {
          List&lt;GetTemperaturesResponse.TemperatureInfo&gt; temperatures = weatherService.getTemperatures(request.getCity(), request.getDate());
  
          return new GetTemperaturesResponse(temperatures);
      }       
  }
  </code></pre>
  
  <p><strong>the test</strong></p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)  
  @ContextConfiguration(locations = {"classpath:servlet.xml"})
  
  public class testOther {
  
      @Autowired
      private ApplicationContext applicationContext;                                           
      private MockWebServiceClient mockClient;
  
      @Before
      public void createClient() {
        mockClient = MockWebServiceClient.createClient(applicationContext);                  
      }
  
      @Test 
      public void TemperatureMarshallingEndpoint() throws Exception {
          Source requestPayload = new StringSource( 
          "&lt;GetTemperaturesRequest xmlns='http://test.au/schema/weather'&gt;" +
          "&lt;city&gt;Houston&lt;/city&gt;" +
          "&lt;date&gt;2007-12-01&lt;/date&gt;" + 
          "&lt;/GetTemperaturesRequest&gt;");      
  
          Source responsePayload = new StringSource(
          "&lt;GetTemperaturesResponse xmlns='http://test.au/schema/weather'&gt;" +
          "&lt;TemperatureInfo city='Houston' date='2007-12-01'&gt;&lt;min&gt;5.0&lt;/min&gt;&lt;max&gt;10.0&lt;/max&gt;&lt;average&gt;8.0&lt;/average&gt;&lt;/TemperatureInfo&gt;" +
          "&lt;/GetTemperaturesResponse&gt;");
  
          mockClient.sendRequest(withPayload(requestPayload)).  
          andExpect(payload(responsePayload));  
      }
  } 
  </code></pre>
  
  <p>and this test passes so it must be right however the soap output adds the NS2 prefix</p>
  
  <pre><code>DEBUG: org.springframework.ws.server.MessageTracing.sent - 
  Sent response 
  [&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;ns2:GetTemperaturesResponse xmlns:ns2="http://test.au/schema/weather"&gt;
      &lt;ns2:TemperatureInfo city="Houston" date="2007-12-01"&gt;
          &lt;ns2:min&gt;5.0&lt;/ns2:min&gt;
          &lt;ns2:max&gt;10.0&lt;/ns2:max&gt;
          &lt;ns2:average&gt;8.0&lt;/ns2:average&gt;
      &lt;/ns2:TemperatureInfo&gt;
  &lt;/ns2:GetTemperaturesResponse&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;] 
  for request 
  [&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;GetTemperaturesRequest xmlns="http://test.au/schema/weather"&gt;
      &lt;city&gt;Houston&lt;/city&gt;
      &lt;date&gt;2007-12-01&lt;/date&gt;&lt;/GetTemperaturesRequest&gt;
  &lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;]
  </code></pre>
  
  <p>where does this namespace get added?</p>