Results 1 to 4 of 4

Thread: AbstractMarshallingPayloadEndpoint and CastorMarshaller

  1. #1
    Join Date
    Jun 2007
    Posts
    1

    Default AbstractMarshallingPayloadEndpoint and CastorMarshaller

    Please pardon me for these two beginner questions. I am new in the web services world and Spring, but I have read the tutorial and successfully worked on a few simple examples.

    Question # 1:
    I am now implementing a simple web service in which the endpoint extends AbstractMarshallingPayloadEndpoint and uses Castor to marshall a list of Java object to XML. I would like the web service clients to be able to get the XML file result, without having to wrap anything in a SOAP envelop. When implementing the method Object invokeInternal(Object requestObject), what type of object should I return in order to accomplish my goal? For instance, If my object is of type Car (see below). What type of OutputStream will be best? Or should I use another method?

    Object invokeInternal(Object requestObject){
    List cars = ....;
    ...
    CastorMarshaller marshaller = ...
    OutputStream outputstream = new (What type ???);
    marshaller.marshalOutputStream(list, outputstream);
    return outputstream;
    }

    Question #2:
    How can I activate the indentation of the XML resulted in the example above, so that I could better see the XML elements (not for production use)? I did not see any method of CastorMarshaller that enables me to set a castor.properties file in which I could write org.exolab.castor.indent=true

    Question #3:
    InitializingBean.class, which is referenced by AbstractMarshallingPayloadEndpoint is missing in the spring-ws jar file. Therefore, I had to include to core Spring jar. Did I download the wrong jar, or is it the way it is supposed to be?

    Once again, I am sorry for such beginner questions, but I really need some help.
    Thank you in advance.

    John

  2. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by Jkelly View Post
    Question # 1:
    I am now implementing a simple web service in which the endpoint extends AbstractMarshallingPayloadEndpoint and uses Castor to marshall a list of Java object to XML. I would like the web service clients to be able to get the XML file result, without having to wrap anything in a SOAP envelop. When implementing the method Object invokeInternal(Object requestObject), what type of object should I return in order to accomplish my goal? For instance, If my object is of type Car (see below). What type of OutputStream will be best? Or should I use another method?

    Object invokeInternal(Object requestObject){
    List cars = ....;
    ...
    CastorMarshaller marshaller = ...
    OutputStream outputstream = new (What type ???);
    marshaller.marshalOutputStream(list, outputstream);
    return outputstream;
    }
    If you don't want the SOAP envelope wrapped around the marshalled object, you are doing Plain Old Xml (POX). With POX, there is no SOAP envelope, just a XML document. By defining a DomPoxMessageFactory (rather than a SaajSoapMessageFactory, or AxiomSoapMessageFactory), you enable it.


    Quote Originally Posted by Jkelly View Post
    Question #2:
    How can I activate the indentation of the XML resulted in the example above, so that I could better see the XML elements (not for production use)? I did not see any method of CastorMarshaller that enables me to set a castor.properties file in which I could write org.exolab.castor.indent=true
    It is not possible to directly set it, but you could try setting System properties. If that doesn't work, you can override the createMarshaller() or createUnmarshaller methods of the CastorMarshaller, and do your think there. Finally, you can create a JIRA issue, and I can add it to the marshaller.

    Quote Originally Posted by Jkelly View Post
    Question #3:
    InitializingBean.class, which is referenced by AbstractMarshallingPayloadEndpoint is missing in the spring-ws jar file. Therefore, I had to include to core Spring jar. Did I download the wrong jar, or is it the way it is supposed to be?
    No, that's the right way. Spring-WS builds on Spring core. We don't include it, because we don't want to force usage of a specific version of Spring. Spring-WS supports both 1.2.9 and 2.0.5.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Sep 2007
    Posts
    1

    Default

    I am now implementing a simple web service in which the endpoint extends AbstractMarshallingPayloadEndpoint and uses Castor to marshall a list of Java object to XML. I would like the web service clients to be able to get the XML file result, wrapped in a SOAP envelop.
    Object invokeInternal(Object requestObject){
    List cars = ....;
    ...
    CastorMarshaller marshaller = ...
    OutputStream outputstream = new (What type ???);
    marshaller.marshalOutputStream(list, outputstream);
    return outputstream;
    }

  4. #4
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •