title: Spring MVC: Receive XML data and Send String message back
body: <p>I am trying to collect all the form data and send it as a XML to Controller. This XML will further be sent to back end which will take care of it.<br/>
  There is no need to marshal this XML into an Object.After receiving this XML I just need to send a <code>String success</code> message back.
  <br/> It is <strong>half working</strong>. I am able to receive XML message from UI page and able to print it on console. But when I just send success message back UI ajax call receives <br/><strong><code>No conversion from text to application/xml</code></strong></p>
  
  <pre><code>@RequestMapping(value="/save",method=RequestMethod.POST,consumes={"application/json", "application/xml", "text/xml","text/plain"})
          @ResponseBody public String handleSave(@RequestBody String formData)
          {
              System.out.println("comes here");
              System.out.println(formData);
  return "Success";
  
      } 
  
  $('form').submit(function () {
                      $.ajax({
                          url: $(this).attr('action'),
                          type: 'POST',
                          processData: false,
                          data: collectFormData1(),
  
                          headers: {
                              "Content-Type":"application/xml"
                          },
                          dataType: 'application/xml',
                          success: function (data) {
                              alert('Success:'+data)
                          },
                          error: function (jqXHR, textStatus, errorThrown) {
                              console.log('jqXHR:'+jqXHR+'\n'+'textStatus:'+'\n'+textStatus+'errorThrown::'+errorThrown);
                          }
                      });
  
                      return false;
                  });
  </code></pre>