Announcement Announcement Module
No announcement yet.
Using PayloadRoot Annotation and a DOM Endpoint Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using PayloadRoot Annotation and a DOM Endpoint

    I'd like to use JDOM, and therefore the AbstractJDomPayloadEndpoint for my endpoint implementation. However, I'd also like to do configuration through annotations as much as possible. Therefore, I'd like to have some way to have endpoint mapping done with the @PayloadRoot annotation while still using the AbstractJDomPayloadEndpoint.

    Is there a way I'm missing to do this? Is there instead a different way I should easily integrate JDOM without inheriting from the abstract class?

  • #2
    Yes, you can use JDOM via the javax.xml.transform.Source abstraction, so it takes a little more plumbing, but it will work. Just define a method like so:

    public Source myEndointMethod(Source request) {
      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      JDOMResult result = new JDOMResult();
      transformer.transform(request, result);
      Document document = result.getDocument();
      // use the JDOM document
    and do the reverse for the response.


    • #3
      Thanks. I did eventually look at the source for the AbstractJDomPayloadEndpoint and saw what it took, and did pretty much what you've suggested. Would it be a desirable for me to put in a JIRA request for DOM, JDOM, DOM4J and XOM type method signatures to be supported when using the @PayloadRoot annotation and have this be done automatically in a future version?


      • #4
        I've logged my request here: