# Class MessageTransformer

java.lang.Object
com.sun.messaging.xml.MessageTransformer

public class MessageTransformer extends Object
The `Transformer` class encapsulates the functionality to transform SOAP and JMS messages.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static jakarta.xml.soap.SOAPMessage`
  `SOAPMessageFromJMSMessage(jakarta.jms.Message message, jakarta.xml.soap.MessageFactory messageFactory)`
  Extracts a `jakarta.xml.soap.SOAPMessage` object from the `jakarta.jms.Message` object into which it was transformed using the `SOAPMessageIntoJMSMessage` method.
  `static jakarta.jms.Message`
  `SOAPMessageIntoJMSMessage(jakarta.xml.soap.SOAPMessage soapMessage, jakarta.jms.Session session)`
  Transforms a `jakarta.xml.soap.SOAPMessage` message into a `jakarta.jms.Message` message.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### SOAPMessageIntoJMSMessage

    public static jakarta.jms.Message SOAPMessageIntoJMSMessage(jakarta.xml.soap.SOAPMessage soapMessage, jakarta.jms.Session session) throws com.sun.messaging.xml.MessageTransformerException
    Transforms a `jakarta.xml.soap.SOAPMessage` message into a `jakarta.jms.Message` message.
    Parameters:
      `soapMessage` - the SOAPMessage to be converted to the JMS Message.
      `session` - The JMS Session to be used to construct the JMS Message.
    Throws:
      `com.sun.messaging.xml.MessageTransformerException` - If any error is encountered when transforming the message.

  - ### SOAPMessageFromJMSMessage

    public static jakarta.xml.soap.SOAPMessage SOAPMessageFromJMSMessage(jakarta.jms.Message message, jakarta.xml.soap.MessageFactory messageFactory) throws com.sun.messaging.xml.MessageTransformerException
    Extracts a `jakarta.xml.soap.SOAPMessage` object from the `jakarta.jms.Message` object into which it was transformed using the `SOAPMessageIntoJMSMessage` method. The `MessageFactory` parameter is used to construct the `jakarta.xml.soap.SOAPMessage` object.

    If `MessageFactory` is `null` then the default SOAP MessageFactory will be used to construct the SOAP message.

    Parameters:
      `message` - The JMS message from which the SOAP message is to be extracted.
      `messageFactory` - The SOAP MessageFactory to be used to contruct the SOAP message.
    Throws:
      `com.sun.messaging.xml.MessageTransformerException` - If any error is encountered when extracting the message.