org.apache.camel.dataformat.soap
Class SoapJaxbDataFormat

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.converter.jaxb.JaxbDataFormat
          extended by org.apache.camel.dataformat.soap.SoapJaxbDataFormat
All Implemented Interfaces:
org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

public class SoapJaxbDataFormat
extends org.apache.camel.converter.jaxb.JaxbDataFormat

Data format supporting SOAP 1.1 and 1.2.


Field Summary
static String SOAP_UNMARSHALLED_HEADER_LIST
           
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
SoapJaxbDataFormat()
          Remember to set the context path when using this constructor
SoapJaxbDataFormat(String contextPath)
          Initialize with JAXB context path
SoapJaxbDataFormat(String contextPath, ElementNameStrategy elementNameStrategy)
          Initialize the data format.
SoapJaxbDataFormat(String contextPath, String elementNameStrategyRef)
          Initialize the data format.
 
Method Summary
protected  void checkElementNameStrategy(org.apache.camel.Exchange exchange)
           
protected  List<JAXBElement<?>> createContentFromObject(Object inputObject, String soapAction, List<JAXBElement<?>> 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()
           
 ElementNameStrategy getElementNameStrategy()
           
 String getElementNameStrategyRef()
           
 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 setElementNameStrategyRef(String elementNameStrategyRef)
           
 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, getNamespacePrefix, getNamespacePrefixRef, getPartClass, getPartNamespace, getSchema, getSchemaFactory, getXmlStreamWriterWrapper, isFilterNonXmlChars, isFragment, isIgnoreJAXBElement, isPrettyPrint, needFiltering, setCamelContext, setContext, setContextPath, setEncoding, setFilterNonXmlChars, setFragment, setIgnoreJAXBElement, setNamespacePrefix, setNamespacePrefixRef, setPartClass, setPartNamespace, setPrettyPrint, setSchema, setSchemaFactory, setXmlStreamWriterWrapper
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, 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

SoapJaxbDataFormat

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


SoapJaxbDataFormat

public SoapJaxbDataFormat(String contextPath)
Initialize with JAXB context path


SoapJaxbDataFormat

public SoapJaxbDataFormat(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


SoapJaxbDataFormat

public SoapJaxbDataFormat(String contextPath,
                          String elementNameStrategyRef)
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

doStart

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

checkElementNameStrategy

protected void checkElementNameStrategy(org.apache.camel.Exchange exchange)

marshal

public void marshal(org.apache.camel.Exchange exchange,
                    Object inputObject,
                    OutputStream stream)
             throws IOException,
                    SAXException
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,SAXException
IOException
SAXException

createContentFromObject

protected List<JAXBElement<?>> createContentFromObject(Object inputObject,
                                                       String soapAction,
                                                       List<JAXBElement<?>> headerElements)
Create body content from a non Exception object. If the inputObject is a BeanInvocation the following should be considered: The first parameter will be used for the SOAP body. BeanInvocations with more than one parameter are not supported. 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,
                        SAXException
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,SAXException
IOException
SAXException

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

getElementNameStrategy

public ElementNameStrategy getElementNameStrategy()

setElementNameStrategy

public void setElementNameStrategy(Object nameStrategy)

getElementNameStrategyRef

public String getElementNameStrategyRef()

setElementNameStrategyRef

public void setElementNameStrategyRef(String elementNameStrategyRef)

isIgnoreUnmarshalledHeaders

public boolean isIgnoreUnmarshalledHeaders()

setIgnoreUnmarshalledHeaders

public void setIgnoreUnmarshalledHeaders(boolean ignoreUnmarshalledHeaders)

getVersion

public String getVersion()
Specified by:
getVersion in interface org.apache.camel.StatefulService
Overrides:
getVersion in class org.apache.camel.support.ServiceSupport

setVersion

public void setVersion(String version)


Apache Camel