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

  • Get SOAP request as XML in Spring MVC

    I need to get the XML Soap request coming to a url on my server. I wrote something like

    Code:
    @RequestMapping("/SomeService")
    @ResponseBody
    public String index(@RequestBody String request) {
        mailService.sendMail("[email protected]", "Subject", request);
        return "";
    }
    But the request body is coming as blank. I'm using spring 3.2. I just need the XML SOAP content. How do I proceed in this case for just storing the final values. Thanks in advance.

  • #2
    Try to use Spring CNVR. With the help of it you will be available to configure any representation form for your resources doesn't matter if it will be JSON, XML, CSV etc.

    Comment


    • #3
      Originally posted by Fruzenshtein View Post
      Try to use Spring CNVR. With the help of it you will be available to configure any representation form for your resources doesn't matter if it will be JSON, XML, CSV etc.
      Pls help how to get the XML Soap request by using Spring CNVR. Soap request is sent in post header. How can we get that value.

      Comment


      • #4
        Paul Chapman has already described how to work with CNVR in one of the Spring Blog posts. Just read the article

        Comment


        • #5
          Originally posted by Fruzenshtein View Post
          Paul Chapman has already described how to work with CNVR in one of the Spring Blog posts. Just read the article
          Hi,

          I do not want to generate any xml. I just want to read the XML that is being posted on to a controller in Spring MVC. When I try to read with @RequestBody, I'm getting the value as blank. I do not want to generate any response but to just read the XML. I know that since its a SOAP request, the data is passed as XML.

          Comment


          • #6
            Read about message-converters
            MarshallingHttpMessageConverter

            An HttpMessageConverter implementation that can read and write XML using Spring's Marshaller and Unmarshaller abstractions from the org.springframework.oxm package. This converter requires a Marshaller and Unmarshaller before it can be used. These can be injected via constructor or bean properties. By default this converter supports (text/xml) and (application/xml).

            Comment


            • #7
              Originally posted by Fire View Post
              Read about message-converters
              Sorry Fire. Even that is not my issue. I just need to get the XML data. Marshalling is the secondary question. How do I receive that into a variable.

              Comment

              Working...
              X