Class Message


  • @SupportedAll
    public class Message
    extends Object
    The Message class is used by web service client and server to construct request or response. It will be sent over the SOAP connection. The Message contains SOAP headers and bodies. The SOAP binding defines the following headers: CorrelationHeader, ProviderHeader, ConsentHeader, UsageDirectiveHeader, ProcessingContextHeader and ServiceInstanceUpdateHeader. The first 2 are required and the others are optional. Signing is mandatory for CorrelationHeader and SOAP Body element which is the parent of the bodies. Other headers are optional, so each header needs to have a flag to specify whether it needs to be signed or not. For each header that needs to be signed, it must have an id attribute in the top element. The constuctor will take a SAML assertion or cert alias in order to sign.
    • Field Detail

      • ANONYMOUS

        public static final int ANONYMOUS
        anonymous profile is specified.
        See Also:
        Constant Field Values
      • X509_TOKEN

        public static final int X509_TOKEN
        X509 Token profile is specified.
        See Also:
        Constant Field Values
      • SAML_TOKEN

        public static final int SAML_TOKEN
        SAML Token profile is specified.
        See Also:
        Constant Field Values
      • BEARER_TOKEN

        public static final int BEARER_TOKEN
        Bearer Token profile is specified.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Message

        public Message()
        Default Constructor.
      • Message

        public Message​(SOAPFault soapFault)
        This constructor is to create a SOAP fault message.
        Parameters:
        soapFault - SOAPFault
    • Method Detail

      • getSecurityProfileType

        public int getSecurityProfileType()
        Gets security profile type. Possible values are ANONYMOUS, X509_TOKEN and SAML_TOKEN.
        Returns:
        the Security Profile type
      • getCorrelationHeader

        public CorrelationHeader getCorrelationHeader()
        Returns the CorrelationHeader.
        Returns:
        the CorrelationHeader.
      • getConsentHeader

        public ConsentHeader getConsentHeader()
        Returns the ConsentHeader.
        Returns:
        the ConsentHeader.
      • getUsageDirectiveHeaders

        public List getUsageDirectiveHeaders()
        Returns a list of UsageDirectiveHeader.
        Returns:
        a list of UsageDirectiveHeader.
      • getOtherSOAPHeaders

        public List getOtherSOAPHeaders()
        Returns a list of SOAP headers except CorrelationHeader, ConsentHeader, UsageDirectiveHeader and Security header. Each entry will be a org.w3c.dom.Element.
        Returns:
        a list of SOAP headers
      • getSOAPFault

        public SOAPFault getSOAPFault()
        Returns the SOAPFault.
        Returns:
        the SOAPFault.
      • getBodies

        public List getBodies()
        Returns a list of SOAP bodies. Each entry will be a org.w3c.dom.Element.
        Returns:
        a list of SOAP bodies
      • getAssertion

        public SecurityAssertion getAssertion()
        Returns the SAML assertion used for signing.
        Returns:
        the SAML assertion.
      • getPeerCertificate

        public X509Certificate getPeerCertificate()
        Returns the X509 certificate used in client authentication.
        Returns:
        a X509 certificate
      • getMessageCertificate

        public X509Certificate getMessageCertificate()
        Returns the X509 certificate used in message level authentication.
        Returns:
        a X509 certificate.
      • getToken

        public Object getToken()
        Returns a token for the sender of this Message.
        Returns:
        a token Object.
      • getSigningIds

        public List getSigningIds()
        Returns a list of id's for signing.
        Returns:
        a list of id's for signing.
      • setSOAPBody

        public void setSOAPBody​(Element body)
        Sets a SOAP body. To send a SOAP Fault, please use method setSOAPFault.
        Parameters:
        body - a org.w3c.dom.Element
      • toString

        public String toString()
        Returns the SOAP message in String format.
        Overrides:
        toString in class Object
        Returns:
        the SOAP message in String format.
      • toDocument

        public Document toDocument​(boolean refresh)
                            throws SOAPBindingException
        Returns the SOAP message in org.w3c.dom.Document format.
        Parameters:
        refresh - true to reconstruct a document, false to reuse a previous document. If previous document doesn't exist, it will construct a new document.
        Returns:
        the SOAP message in org.w3c.dom.Document format.
        Throws:
        SOAPBindingException - if an error occurs while constructing the org.w3c.dom.Document.
      • getWSFVersion

        public String getWSFVersion()
        Returns the web services version of the message.
        Returns:
        the web services version.