Announcement Announcement Module
No announcement yet.
accessing the marshaller within the AbstractMarshallingPayloadEndpoint for a class Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • accessing the marshaller within the AbstractMarshallingPayloadEndpoint for a class

    I'm hopsing someone can lend some advice on why I can't marshall a string myself within my endpoint.

    I am using an AbstractMarshallingPayloadEndpoint, however for one of the classes I'm working with I want to call the marshaller and marshall to a string (which then can be added to the response returned).

    My Endpoint has "private Marshaller marshaller" declared, and my applicationContext references marshaller for the endpoint, but even if I try to evaluate what the marshaller is using afterMarshallerSet, it seems to be null.

    I want to do something like this to get the string:

    StringWriter stringWriter = new StringWriter();
    StreamResult result = new StreamResult(stringWriter);
    this.marshaller.marshal(new JAXBElement(new QName(NAMESPACE_URI,
    workflowListResponse), result);
    String myXmlString = stringWriter.toString();

    and my applicationContext.xml has the following entries (among others):

    <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="contextPath" value="" />

    <bean id="workflowListEndpoint" class="" >
    <property name="wfTemplateDao" ref="wfTemplateDao"/>
    <property name="marshaller" ref="jaxb2Marshaller" />
    <property name="unmarshaller" ref="jaxb2Marshaller" />

    Am I wrong in assuming that I should be able to access the marshaller in this way and marshall a string myself?

  • #2
    The marshaller fields of the AbstractMarshallingPayloadEndpoint are not exposed to subclasses since they're private. I could add getters for them, so you can directly use them in subclasses.


    • #3

      Hi Arjen,
      If you don't mind adding the getters, that would be good.
      At the moment I've switched to use an AbstractDomPayloadEndpoint
      instead of the AbstractMarshallingPayloadEndpoint to avoid this problem, but if you had getters for the marshaller in the AbstractMarshallingPayloadEndpoint I would have stayed with that.
      Thanks a lot.
      .. .Rich
      Last edited by farrellr; Aug 14th, 2006, 08:49 AM. Reason: add commen


      • #4
        The getters are available in SVN.


        • #5
          thanks again

          Excellent - thanks for the quick response.
          ... Rich