Class SoapDataFormat

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.converter.jaxb.JaxbDataFormat
org.apache.camel.dataformat.soap.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 final String
     

    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
  • Constructor Summary

    Constructors
    Constructor
    Description
    Remember to set the context path when using this constructor
    SoapDataFormat(String contextPath)
    Initialize with JAXB context path
    SoapDataFormat(String contextPath, ElementNameStrategy elementNameStrategy)
    Initialize the data format.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<Object>
    createContentFromObject(Object inputObject, String soapAction)
    Create body content from a non Exception object.
    protected jakarta.xml.bind.JAXBContext
    Added the generated SOAP package to the JAXB context so Soap datatypes are available
    protected void
     
     
     
     
    boolean
     
    void
    marshal(org.apache.camel.Exchange exchange, Object inputObject, OutputStream stream)
    Marshal inputObjects to SOAP xml.
    void
     
    void
    setIgnoreUnmarshalledHeaders(boolean ignoreUnmarshalledHeaders)
     
    void
    setVersion(String version)
     
    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, createUnmarshaller, doStop, getAccessExternalSchemaProtocols, getCamelContext, getContext, getContextPath, getEncoding, getJaxbProviderProperties, getNamespacePrefix, getNoNamespaceSchemaLocation, getPartClass, getPartNamespace, getSchema, getSchemaFactory, getSchemaLocation, getSchemaSeverityLevel, getXmlStreamWriterWrapper, isContentTypeHeader, isContextPathIsClassName, isFilterNonXmlChars, isFragment, isIgnoreJAXBElement, isMustBeJAXBElement, isObjectFactory, isPrettyPrint, needFiltering, setAccessExternalSchemaProtocols, 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 class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    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
  • Field Details

  • Constructor Details

    • 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 Details

    • 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)
      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
      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 jakarta.xml.bind.JAXBContext createContext() throws jakarta.xml.bind.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:
      jakarta.xml.bind.JAXBException
    • getElementNameStrategy

      public ElementNameStrategy getElementNameStrategy()
    • 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)