Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-709

CXF - Easier use for end-user to retreive POJO data

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4.0
    • 1.4.0
    • camel-cxf
    • None

    Description

      I am working on a web app example that uses CXF to expose a webservice.

      During the process I thought that getting my POJO object (InputReportIncident) was a bit clumsy as I had to do;

                      MessageContentsList list = exchange.getIn().getBody(MessageContentsList.class);
                      InputReportIncident in = (InputReportIncident) list.get(0);
      

      So I have created a patch that improves the getBody to be more end-user friendly.
      You can now do, as you always do in Camel:

                      InputReportIncident in = exchange.getIn().getBody(InputReportIncident.class);
      

      Just cast it to what you expect and want to work with.

      InputReportIncident is a POJO object generated by the CXF wsdl2java generator.

      Willem could you take a look? Maybe I have misunderstood the CXF and there is a easier way already. But I don't like the need to get the List and then get (0) to get my POJO.

      Sending the response is already supported nicely:

                      // the response
                      OutputReportIncident out = new OutputReportIncident();
                      out.setCode("Bye Claus");
                      exchange.getOut().setBody(out);
      

      Attachments

        1. camel_709.patch
          2 kB
          Claus Ibsen

        Activity

          People

            njiang Willem Jiang
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: