com.sun.identity.liberty.ws.soapbinding
Class Message

java.lang.Object
  |
  +--com.sun.identity.liberty.ws.soapbinding.Message

public class Message
extends java.lang.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 Summary
static int ANONYMOUS
          anonymous profile is specified.
static int BEARER_TOKEN
          Bearer Token profile is specified.
static java.lang.String CLIENT_TLS_BEARER
          Authentication mechanism "urn:liberty:security:2004-04:ClientTLS:Bearer"
static java.lang.String CLIENT_TLS_NULL
          Authentication mechanism "urn:liberty:security:2003-08:ClientTLS:null"
static java.lang.String CLIENT_TLS_SAML
          Authentication mechanism "urn:liberty:security:2003-08:ClientTLS:SAML"
static java.lang.String CLIENT_TLS_X509
          Authentication mechanism "urn:liberty:security:2003-08:ClientTLS:X509"
static java.lang.String NULL_BEARER
          Authentication mechanism "urn:liberty:security:2004-04:null:Bearer"
static java.lang.String NULL_NULL
          Authentication mechanism "urn:liberty:security:2003-08:null:null"
static java.lang.String NULL_SAML
          Authentication mechanism "urn:liberty:security:2003-08:null:SAML"
static java.lang.String NULL_X509
          Authentication mechanism "urn:liberty:security:2003-08:null:X509"
static int SAML_TOKEN
          SAML Token profile is specified.
static java.lang.String TLS_BEARER
          Authentication mechanism "urn:liberty:security:2004-04:TLS:Bearer"
static java.lang.String TLS_NULL
          Authentication mechanism "urn:liberty:security:2003-08:TLS:null"
static java.lang.String TLS_SAML
          Authentication mechanism "urn:liberty:security:2003-08:TLS:SAML"
static java.lang.String TLS_X509
          Authentication mechanism "urn:liberty:security:2003-08:TLS:X509"
static int X509_TOKEN
          X509 Token profile is specified.
 
Constructor Summary
Message()
          The default constructor uses default cert alias defined in AMConfig for signing.
Message(java.io.InputStream inputStream)
          This constructor takes an InputStream.
Message(ProviderHeader providerHeader)
          The default constructor uses default cert alias defined in AMConfig for signing.
Message(ProviderHeader providerHeader, BinarySecurityToken token)
          This constructor takes a binary security token for signing.
Message(ProviderHeader providerHeader, SecurityAssertion assertion)
          This constructor takes a SAML assertion for signing.
Message(SOAPFault soapFault)
          This constructor is to create a SOAP fault message.
 
Method Summary
 SecurityAssertion getAssertion()
          Returns the SAML assertion used for signing.
 java.lang.String getAuthenticationMechanism()
          Gets authentication mechanism.
 BinarySecurityToken getBinarySecurityToken()
          Returns a binary security token used for signing.
 java.util.List getBodies()
          Returns a list of SOAP bodies.
 java.util.List getBodies(java.lang.String namespaceURI, java.lang.String localName)
          Returns a list of SOAP bodies.
 ConsentHeader getConsentHeader()
          Returns ConsentHeader.
 CorrelationHeader getCorrelationHeader()
          Returns CorrelationHeader.
 java.lang.String getIPAddress()
          Returns the IP address of remote site of the SOAP connection.
 java.security.cert.X509Certificate getMessageCertificate()
          Returns the X509 certificate used in message level authentication
 java.util.List getOtherSecurityHeaders()
          Returns a list of security header except the SAML assertion used in SAML token profile or the binary security token used in X509 token profile.
 java.util.List getOtherSOAPHeaders()
          Returns a list of SOAP headers except CorrelationHeader, ConsentHeader, UsageDirectiveHeader and 'Security' header.
 java.security.cert.X509Certificate getPeerCertificate()
          Returns the X509 certificate used in client authentication
 ProcessingContextHeader getProcessingContextHeader()
          Returns ProcessingContextHeader.
 ProviderHeader getProviderHeader()
          Returns ProviderHeader.
 int getSecurityProfileType()
          Gets security profile type.
 ServiceInstanceUpdateHeader getServiceInstanceUpdateHeader()
          Returns ServiceInstanceUpdateHeader.
 java.util.List getSigningIds()
          Returns a list of id's for signing.
 SOAPFault getSOAPFault()
          Returns SOAPFault
 java.lang.Object getToken()
          Returns a token for the sender of this Message.
 java.util.List getUsageDirectiveHeaders()
          Returns a list of UsageDirectiveHeader.
 boolean isClientAuthentication()
          Returns a boolean flag to determine if this Message will be sent to a server that requires client authentication.
 void setClientAuthentication(boolean clientAuthentication)
          Sets a boolean flag.
 void setConsentHeader(ConsentHeader consentHeader)
          Sets ConsentHeader.
 void setCorrelationHeader(CorrelationHeader correlationHeader)
          Sets CorrelationHeader.
 void setOtherSecurityHeader(org.w3c.dom.Element header)
          Sets a security header.
 void setOtherSecurityHeaders(java.util.List headers)
          Sets a list of security headers.
 void setOtherSOAPHeader(org.w3c.dom.Element header, java.lang.String signingId)
          Sets a SOAP header except CorrelationHeader, ConsentHeader and UsageDirectiveHeader.
 void setOtherSOAPHeaders(java.util.List headers, java.util.List signingIds)
          Sets a list of SOAP headers except CorrelationHeader, ConsentHeader, UsageDirectiveHeader and 'Security' header.
 void setProcessingContextHeader(ProcessingContextHeader processingContextHeader)
          Sets ProcessingContextHeader.
 void setProviderHeader(ProviderHeader providerHeader)
          Sets ProviderHeader if it is not null.
 void setServiceInstanceUpdateHeader(ServiceInstanceUpdateHeader serviceInstanceUpdateHeader)
          Sets ServiceInstanceUpdateHeader.
 void setSOAPBodies(java.util.List bodies)
          Sets a list of SOAP bodies.
 void setSOAPBody(org.w3c.dom.Element body)
          Sets a SOAP body.
 void setSOAPFault(SOAPFault soapFault)
          Sets SOAPFault.
 void setUsageDirectiveHeaders(java.util.List usageDirectiveHeaders)
          Sets a list of UsageDirectiveHeader.
 org.w3c.dom.Document toDocument()
          Returns the SOAP message in org.w3c.dom.Document format
 org.w3c.dom.Document toDocument(boolean refresh)
          Returns the SOAP message in org.w3c.dom.Document format
 java.lang.String toString()
          Returns the SOAP message in String format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANONYMOUS

public static final int ANONYMOUS
anonymous profile is specified.

X509_TOKEN

public static final int X509_TOKEN
X509 Token profile is specified.

SAML_TOKEN

public static final int SAML_TOKEN
SAML Token profile is specified.

BEARER_TOKEN

public static final int BEARER_TOKEN
Bearer Token profile is specified.

NULL_NULL

public static final java.lang.String NULL_NULL
Authentication mechanism "urn:liberty:security:2003-08:null:null"

NULL_X509

public static final java.lang.String NULL_X509
Authentication mechanism "urn:liberty:security:2003-08:null:X509"

NULL_SAML

public static final java.lang.String NULL_SAML
Authentication mechanism "urn:liberty:security:2003-08:null:SAML"

NULL_BEARER

public static final java.lang.String NULL_BEARER
Authentication mechanism "urn:liberty:security:2004-04:null:Bearer"

TLS_NULL

public static final java.lang.String TLS_NULL
Authentication mechanism "urn:liberty:security:2003-08:TLS:null"

TLS_X509

public static final java.lang.String TLS_X509
Authentication mechanism "urn:liberty:security:2003-08:TLS:X509"

TLS_SAML

public static final java.lang.String TLS_SAML
Authentication mechanism "urn:liberty:security:2003-08:TLS:SAML"

TLS_BEARER

public static final java.lang.String TLS_BEARER
Authentication mechanism "urn:liberty:security:2004-04:TLS:Bearer"

CLIENT_TLS_NULL

public static final java.lang.String CLIENT_TLS_NULL
Authentication mechanism "urn:liberty:security:2003-08:ClientTLS:null"

CLIENT_TLS_X509

public static final java.lang.String CLIENT_TLS_X509
Authentication mechanism "urn:liberty:security:2003-08:ClientTLS:X509"

CLIENT_TLS_SAML

public static final java.lang.String CLIENT_TLS_SAML
Authentication mechanism "urn:liberty:security:2003-08:ClientTLS:SAML"

CLIENT_TLS_BEARER

public static final java.lang.String CLIENT_TLS_BEARER
Authentication mechanism "urn:liberty:security:2004-04:ClientTLS:Bearer"
Constructor Detail

Message

public Message()
The default constructor uses default cert alias defined in AMConfig for signing.

Message

public Message(ProviderHeader providerHeader)
        throws SOAPBindingException
The default constructor uses default cert alias defined in AMConfig for signing.
Parameters:
providerHeader - ProviderHeader
Throws:
SOAPBindingException - if provider header is null

Message

public Message(ProviderHeader providerHeader,
               SecurityAssertion assertion)
        throws SOAPBindingException
This constructor takes a SAML assertion for signing.
Parameters:
providerHeader - ProviderHeader
assertion - a SAML assertion
Throws:
SOAPBindingException - if an error occurs while processing the SAML assertion or the provider header is null

Message

public Message(ProviderHeader providerHeader,
               BinarySecurityToken token)
        throws SOAPBindingException
This constructor takes a binary security token for signing.
Parameters:
providerHeader - ProviderHeader
token - a binary security token
Throws:
SOAPBindingException - if an error occurs while processing the token or the provider header is null

Message

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

Message

public Message(java.io.InputStream inputStream)
        throws SOAPBindingException
This constructor takes an InputStream.
Parameters:
inputStream - an InputStream
Throws:
SOAPBindingException - if an error occurs while parsing the input
Method Detail

getSecurityProfileType

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

getAuthenticationMechanism

public java.lang.String getAuthenticationMechanism()
Gets authentication mechanism. Possible values are NULL_NULL, NULL_X509, NULL_SAML, TLS_NULL, TLS_X509, TLS_SAML, CLIENT_TLS_NULL, CLIENT_TLS_X509 and CLIENT_TLS_SAML.
Returns:
an authentication mechanism

isClientAuthentication

public boolean isClientAuthentication()
Returns a boolean flag to determine if this Message will be sent to a server that requires client authentication.
Returns:
true if this Message will be sent to a server that requires client authentication

getCorrelationHeader

public CorrelationHeader getCorrelationHeader()
Returns CorrelationHeader.
Returns:
CorrelationHeader

getConsentHeader

public ConsentHeader getConsentHeader()
Returns ConsentHeader.
Returns:
ConsentHeader

getUsageDirectiveHeaders

public java.util.List getUsageDirectiveHeaders()
Returns a list of UsageDirectiveHeader.
Returns:
a list of UsageDirectiveHeader

getProviderHeader

public ProviderHeader getProviderHeader()
Returns ProviderHeader.
Returns:
ProviderHeader

getProcessingContextHeader

public ProcessingContextHeader getProcessingContextHeader()
Returns ProcessingContextHeader.
Returns:
ProcessingContextHeader

getServiceInstanceUpdateHeader

public ServiceInstanceUpdateHeader getServiceInstanceUpdateHeader()
Returns ServiceInstanceUpdateHeader.
Returns:
ServiceInstanceUpdateHeader

getOtherSOAPHeaders

public java.util.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 SOAPFault
Returns:
SOAPFault

getBodies

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

getBodies

public java.util.List getBodies(java.lang.String namespaceURI,
                                java.lang.String localName)
Returns a list of SOAP bodies. Each entry will be a org.w3c.dom.Element with specified namespace URI and local name.
Parameters:
namespaceURI - namspace URI
localName - local name
Returns:
a list of SOAP bodies

getOtherSecurityHeaders

public java.util.List getOtherSecurityHeaders()
Returns a list of security header except the SAML assertion used in SAML token profile or the binary security token used in X509 token profile. Each entry will be a org.w3c.dom.Element.
Returns:
a list of security headers

getAssertion

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

getBinarySecurityToken

public BinarySecurityToken getBinarySecurityToken()
Returns a binary security token used for signing.
Returns:
a binary security token

getPeerCertificate

public java.security.cert.X509Certificate getPeerCertificate()
Returns the X509 certificate used in client authentication
Returns:
a X509 certificate

getMessageCertificate

public java.security.cert.X509Certificate getMessageCertificate()
Returns the X509 certificate used in message level authentication
Returns:
a X509 certificate

getToken

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

getIPAddress

public java.lang.String getIPAddress()
Returns the IP address of remote site of the SOAP connection.
Returns:
a IP address

getSigningIds

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

setCorrelationHeader

public void setCorrelationHeader(CorrelationHeader correlationHeader)
Sets CorrelationHeader.
Parameters:
correlationHeader - CorrelationHeader

setConsentHeader

public void setConsentHeader(ConsentHeader consentHeader)
Sets ConsentHeader.
Parameters:
consentHeader - ConsentHeader

setUsageDirectiveHeaders

public void setUsageDirectiveHeaders(java.util.List usageDirectiveHeaders)
Sets a list of UsageDirectiveHeader.
Parameters:
usageDirectiveHeaders - a list of UsageDirectiveHeader

setProviderHeader

public void setProviderHeader(ProviderHeader providerHeader)
Sets ProviderHeader if it is not null.
Parameters:
providerHeader - ProviderHeader

setProcessingContextHeader

public void setProcessingContextHeader(ProcessingContextHeader processingContextHeader)
Sets ProcessingContextHeader.
Parameters:
processingContextHeader - ProcessingContextHeader

setServiceInstanceUpdateHeader

public void setServiceInstanceUpdateHeader(ServiceInstanceUpdateHeader serviceInstanceUpdateHeader)
Sets ServiceInstanceUpdateHeader.
Parameters:
serviceInstanceUpdateHeader - ServiceInstanceUpdateHeader

setOtherSOAPHeaders

public void setOtherSOAPHeaders(java.util.List headers,
                                java.util.List signingIds)
Sets a list of SOAP headers except CorrelationHeader, ConsentHeader, UsageDirectiveHeader and 'Security' header. Each entry will be a org.w3c.dom.Element.
Parameters:
headers - a list of SOAP headers.
signingIds - a list of values of 'id' attribute for signing

setOtherSOAPHeader

public void setOtherSOAPHeader(org.w3c.dom.Element header,
                               java.lang.String signingId)
Sets a SOAP header except CorrelationHeader, ConsentHeader and UsageDirectiveHeader.
Parameters:
header - a org.w3c.dom.Element
signingId - the value of 'id' attribute for signing. a null means no signing

setOtherSecurityHeaders

public void setOtherSecurityHeaders(java.util.List headers)
Sets a list of security headers. Each entry will be a org.w3c.dom.Element.
Parameters:
headers - a list of security headers.

setOtherSecurityHeader

public void setOtherSecurityHeader(org.w3c.dom.Element header)
Sets a security header.
Parameters:
header - a security header

setSOAPFault

public void setSOAPFault(SOAPFault soapFault)
Sets SOAPFault.
Parameters:
soapFault - SOAPFault

setSOAPBodies

public void setSOAPBodies(java.util.List bodies)
Sets a list of SOAP bodies. Each entry will be a org.w3c.dom.Element. To send a SOAP Fault, please use method setSOAPFault.
Parameters:
bodies - a list of SOAP bodies.

setSOAPBody

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

setClientAuthentication

public void setClientAuthentication(boolean clientAuthentication)
Sets a boolean flag. If the flag is true, this Message will be sent to a server that requires client authentication.
Parameters:
clientAuthentication - a boolean flag

toString

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

toDocument

public org.w3c.dom.Document toDocument()
                                throws SOAPBindingException
Returns the SOAP message in org.w3c.dom.Document format
Returns:
the SOAP message in org.w3c.dom.Document format
Throws:
SOAPBindingException - if an error occurs while constructing a document

toDocument

public org.w3c.dom.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


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.