Class SoapDataFormat

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatContentTypeHeader, org.apache.camel.spi.DataFormatName, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Dataformat("soap")
    public class SoapDataFormat
    extends org.apache.camel.converter.jaxb.JaxbDataFormat
    Data format supporting SOAP 1.1 and 1.2.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String SOAP_UNMARSHALLED_HEADER_LIST  
      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected List<Object> createContentFromObject​(Object inputObject, String soapAction, List<Object> headerElements)
      Create body content from a non Exception object.
      protected JAXBContext createContext()
      Added the generated SOAP package to the JAXB context so Soap datatypes are available
      protected void doStart()  
      String getDataFormatName()  
      ElementNameStrategy getElementNameStrategy()  
      String getVersion()  
      boolean isIgnoreUnmarshalledHeaders()  
      void marshal​(org.apache.camel.Exchange exchange, Object inputObject, OutputStream stream)
      Marshal inputObjects to SOAP xml.
      void setElementNameStrategy​(Object nameStrategy)  
      void setIgnoreUnmarshalledHeaders​(boolean ignoreUnmarshalledHeaders)  
      void setVersion​(String version)  
      Object unmarshal​(org.apache.camel.Exchange exchange, InputStream stream)
      Unmarshal a given SOAP xml stream and return the content of the SOAP body
      • Methods inherited from class org.apache.camel.converter.jaxb.JaxbDataFormat

        createMarshaller, createSchemaFactory, createUnmarshaller, doStop, getCamelContext, getContext, getContextPath, getEncoding, getJaxbProviderProperties, getNamespacePrefix, getNoNamespaceSchemaLocation, getPartClass, getPartNamespace, getSchema, getSchemaFactory, getSchemaLocation, getSchemaSeverityLevel, getXmlStreamWriterWrapper, isContentTypeHeader, isContextPathIsClassName, isFilterNonXmlChars, isFragment, isIgnoreJAXBElement, isMustBeJAXBElement, isObjectFactory, isPrettyPrint, needFiltering, setCamelContext, setContentTypeHeader, setContext, setContextPath, setContextPathIsClassName, setEncoding, setFilterNonXmlChars, setFragment, setIgnoreJAXBElement, setJaxbProviderProperties, setMustBeJAXBElement, setNamespacePrefix, setNoNamespaceSchemaLocation, setObjectFactory, setPartClass, setPartNamespace, setPrettyPrint, setSchema, setSchemaFactory, setSchemaLocation, setSchemaSeverityLevel, setXmlStreamWriterWrapper
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • SoapDataFormat

        public SoapDataFormat()
        Remember to set the context path when using this constructor
      • SoapDataFormat

        public SoapDataFormat​(String contextPath)
        Initialize with JAXB context path
      • SoapDataFormat

        public SoapDataFormat​(String contextPath,
                              ElementNameStrategy elementNameStrategy)
        Initialize the data format. The serviceInterface is necessary to determine the element name and namespace of the element inside the soap body when marshalling
    • Method Detail

      • getDataFormatName

        public String getDataFormatName()
        Specified by:
        getDataFormatName in interface org.apache.camel.spi.DataFormatName
        Overrides:
        getDataFormatName in class org.apache.camel.converter.jaxb.JaxbDataFormat
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.converter.jaxb.JaxbDataFormat
        Throws:
        Exception
      • marshal

        public void marshal​(org.apache.camel.Exchange exchange,
                            Object inputObject,
                            OutputStream stream)
                     throws IOException
        Marshal inputObjects to SOAP xml. If the exchange or message has an EXCEPTION_CAUGTH property or header then instead of the object the exception is marshaled. To determine the name of the top level xml elements the elementNameStrategy is used.
        Specified by:
        marshal in interface org.apache.camel.spi.DataFormat
        Overrides:
        marshal in class org.apache.camel.converter.jaxb.JaxbDataFormat
        Throws:
        IOException
      • createContentFromObject

        protected List<Object> createContentFromObject​(Object inputObject,
                                                       String soapAction,
                                                       List<Object> headerElements)
        Create body content from a non Exception object. So the interface should be in doc lit bare style.
        Parameters:
        inputObject - object to be put into the SOAP body
        soapAction - for name resolution
        headerElements - in/out parameter used to capture header content if present
        Returns:
        JAXBElement for the body content
      • unmarshal

        public Object unmarshal​(org.apache.camel.Exchange exchange,
                                InputStream stream)
                         throws IOException
        Unmarshal a given SOAP xml stream and return the content of the SOAP body
        Specified by:
        unmarshal in interface org.apache.camel.spi.DataFormat
        Overrides:
        unmarshal in class org.apache.camel.converter.jaxb.JaxbDataFormat
        Throws:
        IOException
      • createContext

        protected JAXBContext createContext()
                                     throws JAXBException
        Added the generated SOAP package to the JAXB context so Soap datatypes are available
        Overrides:
        createContext in class org.apache.camel.converter.jaxb.JaxbDataFormat
        Throws:
        JAXBException
      • setElementNameStrategy

        public void setElementNameStrategy​(Object nameStrategy)
      • isIgnoreUnmarshalledHeaders

        public boolean isIgnoreUnmarshalledHeaders()
      • setIgnoreUnmarshalledHeaders

        public void setIgnoreUnmarshalledHeaders​(boolean ignoreUnmarshalledHeaders)
      • getVersion

        public String getVersion()
      • setVersion

        public void setVersion​(String version)