Package org.apache.camel.dataformat.soap
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.JaxbDataFormatData format supporting SOAP 1.1 and 1.2.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSOAP_UNMARSHALLED_HEADER_LIST
-
Constructor Summary
Constructors Constructor Description SoapDataFormat()Remember to set the context path when using this constructorSoapDataFormat(String contextPath)Initialize with JAXB context pathSoapDataFormat(String contextPath, ElementNameStrategy elementNameStrategy)Initialize the data format.
-
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 JAXBContextcreateContext()Added the generated SOAP package to the JAXB context so Soap datatypes are availableprotected voiddoStart()StringgetDataFormatName()ElementNameStrategygetElementNameStrategy()StringgetVersion()booleanisIgnoreUnmarshalledHeaders()voidmarshal(org.apache.camel.Exchange exchange, Object inputObject, OutputStream stream)Marshal inputObjects to SOAP xml.voidsetElementNameStrategy(Object nameStrategy)voidsetIgnoreUnmarshalledHeaders(boolean ignoreUnmarshalledHeaders)voidsetVersion(String version)Objectunmarshal(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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
SOAP_UNMARSHALLED_HEADER_LIST
public static final String SOAP_UNMARSHALLED_HEADER_LIST
- See Also:
- Constant Field Values
-
-
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:
getDataFormatNamein interfaceorg.apache.camel.spi.DataFormatName- Overrides:
getDataFormatNamein classorg.apache.camel.converter.jaxb.JaxbDataFormat
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.converter.jaxb.JaxbDataFormat- Throws:
Exception
-
marshal
public void marshal(org.apache.camel.Exchange exchange, Object inputObject, OutputStream stream) throws IOExceptionMarshal 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:
marshalin interfaceorg.apache.camel.spi.DataFormat- Overrides:
marshalin classorg.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 bodysoapAction- for name resolutionheaderElements- 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:
unmarshalin interfaceorg.apache.camel.spi.DataFormat- Overrides:
unmarshalin classorg.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:
createContextin classorg.apache.camel.converter.jaxb.JaxbDataFormat- Throws:
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)
-
-