Announcement Announcement Module
Collapse
No announcement yet.
XML request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML request

    Hallo,

    I have the following problem:
    In a Controller-Server I want do commit a Java-Object with the help of xml. My Contoller looks like:

    @Controller
    public class adding{
    @RequestMapping(value="/adding", method=RequestMethod.POST, headers = "content-type=application/xml")
    public ModelAndView myRequest(@RequestBody User us){
    System.out.println("The user name is:" + us.getName());
    return ModelAndView("adding");
    }
    }

    The Class User has only one private String Name and getter and setter Methods.
    Now I want do test with http4e if my Controller is write. My question is how this request has to look like. I tried it with:

    POST /rest/rest/blogadd HTTP/1.1
    Content-Type: application/xml
    User-Agent: http4e/1.4.3
    Host: localhost:8080
    Content-Length: 30

    <User><name>Mike</name></User>

    But it doesn't work. The error message is:
    java.lang.IllegalStateException: Cannot extract response: no Content-Type found

    Can anybody help me? That would be very nice!!!

    Thank you!!!
    Aspry
Working...
X