org.apache.axis.message.addressing.util
Class AddressingUtils

java.lang.Object
  extended by org.apache.axis.message.addressing.util.AddressingUtils
All Implemented Interfaces:
Constants

public abstract class AddressingUtils
extends java.lang.Object
implements Constants

A set of WS-Addressing-related utility methods.

Version:
$Revision: 14 $
Author:
Jarek Gawor, Rodrigo Ruiz

Field Summary
 
Fields inherited from interface org.apache.axis.message.addressing.Constants
ACTION, ADDRESS, ATTR_REFP, ENDPOINT_REFERENCE, ENV_ADDRESSING_FAULTTO_URI, ENV_ADDRESSING_FROM_URI, ENV_ADDRESSING_NAMESPACE_URI, ENV_ADDRESSING_REPLYTO_URI, ENV_ADDRESSING_REQUEST_HEADERS, ENV_ADDRESSING_REQUIRED, ENV_ADDRESSING_RESP_ACTION, ENV_ADDRESSING_RESPONSE_HEADERS, ENV_ADDRESSING_SEND_REPLYTO, ENV_ADDRESSING_SET_MUST_UNDERSTAND, ENV_ADDRESSING_SHARED_HEADERS, FAULT_DETAIL, FAULT_TO, FROM, MESSAGE_ID, METADATA, NS_PREFIX_ADDRESSING, NS_URI_ADDRESSING, NS_URI_ADDRESSING_2003_03, NS_URI_ADDRESSING_2004_03, NS_URI_ADDRESSING_2004_08, NS_URI_ADDRESSING_2005_08, NS_URI_ADDRESSING_DEFAULT, PORT_NAME, PORT_TYPE, RECIPIENT, REFERENCE_PARAMETERS, REFERENCE_PROPERTIES, RELATES_TO, RELATIONSHIP_TYPE, REPLY, REPLY_TO, RESPONSE, SEND_DEFAULT_FROM, SEND_DEFAULT_MESSAGEID, SEND_DEFAULT_TO, SERVICE_NAME, TO, URI_ANONYMOUS_W3C_CR, URI_NONE_W3C_CR, URI_REPLY, WSDL_ATTRIB_ACTION
 
Constructor Summary
protected AddressingUtils()
          Hidden constructor.
 
Method Summary
static java.lang.String getAddressingNamespaceURI()
          Deprecated.  
static java.lang.String getAddressingNamespaceURI(javax.xml.rpc.handler.MessageContext ctx)
          Returns the namespace URI of the WSA version being used by the request in the specified message context.
static AddressingVersion getAddressingVersion()
          Gets an object describing the WS-Addressing specification represented by the namespace configured at the MessageContext or System level.
static AddressingVersion getAddressingVersion(javax.xml.rpc.handler.MessageContext ctx)
          Gets an object describing the WS-Addressing specification for which the specified message context is configured.
static AddressingVersion getAddressingVersion(java.lang.String ns)
          Gets an object describing the WS-Addressing specification represented by the specified namespace.
static java.lang.String getAnonymousRoleURI()
          Deprecated.  
static java.lang.String getAnonymousRoleURI(javax.xml.rpc.handler.MessageContext ctx)
          Returns the anonymous target URI that is appropriate for the WSA version being used.
static java.lang.String getFaultActionURI()
          Deprecated.  
static java.lang.String getInputAction(javax.xml.namespace.QName portTypeQName, javax.wsdl.Operation operation)
          Gets input action.
static java.lang.String getNamespacePrefix(javax.xml.soap.SOAPElement element, java.lang.String namespace)
          Gets prefix for a given namespace.
static java.lang.String getOutputAction(javax.xml.namespace.QName portTypeQName, javax.wsdl.Operation operation)
          Gets output action.
static AddressingHeaders getRequestHeaders(javax.xml.rpc.handler.MessageContext msgCtx)
          Gets request AddressingHeaders associated with the specified context.
static AddressingHeaders getResponseHeaders(javax.xml.rpc.handler.MessageContext msgCtx)
          Gets response AddressingHeaders associated with the specified context.
static javax.xml.namespace.QName getResponseRelationshipType()
          Returns the response/reply relationship QName that is appropriate for the WSA version being used.
static javax.xml.namespace.QName getResponseRelationshipType(javax.xml.rpc.handler.MessageContext ctx)
          Returns the response/reply relationship QName that is appropriate for the WSA version being used.
static boolean isAddressingNamespaceURI(java.lang.String uri)
          Deprecated.  
static boolean isW3CAddressingNamespaceURI(java.lang.String uri)
          Deprecated.  
static EndpointReference parseReference(java.lang.String epr)
          Parses a string containing an End-point reference in XML format, and translates it into an EndpointReference bean.
static void removeHeader(javax.xml.soap.SOAPHeader soapHeader, java.lang.String actorURI, java.lang.String headerName)
          Removes all instances of a given header name in WSA namespace for a given actor.
static void removeHeaders(javax.xml.soap.SOAPHeader soapHeader, java.lang.String actorURI)
          Removes all instances of all WSA headers for a given actor.
static java.lang.String toString(EndpointReference epr, boolean prettyPrint)
          Converts an End-Point Reference into an XML String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddressingUtils

protected AddressingUtils()
Hidden constructor.

Method Detail

removeHeader

public static void removeHeader(javax.xml.soap.SOAPHeader soapHeader,
                                java.lang.String actorURI,
                                java.lang.String headerName)
Removes all instances of a given header name in WSA namespace for a given actor.

Parameters:
soapHeader - Header containing the element to remove
actorURI - Actor URI
headerName - element name

getAddressingVersion

public static AddressingVersion getAddressingVersion(javax.xml.rpc.handler.MessageContext ctx)
Gets an object describing the WS-Addressing specification for which the specified message context is configured.

Parameters:
ctx - Message context
Returns:
An AddressingVersion instance, or null

getAddressingVersion

public static AddressingVersion getAddressingVersion(java.lang.String ns)
Gets an object describing the WS-Addressing specification represented by the specified namespace.

Parameters:
ns - Addressing namespace URI
Returns:
An AddressingVersion instance, or null

getAddressingVersion

public static AddressingVersion getAddressingVersion()
Gets an object describing the WS-Addressing specification represented by the namespace configured at the MessageContext or System level.

Returns:
An AddressingVersion instance, or null

isAddressingNamespaceURI

public static boolean isAddressingNamespaceURI(java.lang.String uri)
Deprecated. 

Returns true if the specified URI is corresponds to the namespace URI of a supported version of the WSA specification, or false otherwise.

Parameters:
uri - a URI
Returns:
true if the specified URI is a valid addressing namespace

isW3CAddressingNamespaceURI

public static boolean isW3CAddressingNamespaceURI(java.lang.String uri)
Deprecated. 

Returns true if the specified URI is corresponds to the namespace URI of a supported version of the WSA specification using the W3C specs, or false otherwise.

Parameters:
uri - a URI
Returns:
true if the specified URI is a valid W3C addressing namespace

removeHeaders

public static void removeHeaders(javax.xml.soap.SOAPHeader soapHeader,
                                 java.lang.String actorURI)
Removes all instances of all WSA headers for a given actor.

Parameters:
soapHeader - header container
actorURI - Actor URI

getResponseHeaders

public static AddressingHeaders getResponseHeaders(javax.xml.rpc.handler.MessageContext msgCtx)
Gets response AddressingHeaders associated with the specified context. If there are no AddressingHeaders associated with the context, new reponse AddressingHeaders are created and associated with the context.

Parameters:
msgCtx - Context information
Returns:
The addressing headers container

getRequestHeaders

public static AddressingHeaders getRequestHeaders(javax.xml.rpc.handler.MessageContext msgCtx)
Gets request AddressingHeaders associated with the specified context. If there are no AddressingHeaders associated with the context, new request AddressingHeaders are created and associated with the context.

Parameters:
msgCtx - Context information
Returns:
The headers container

getInputAction

public static java.lang.String getInputAction(javax.xml.namespace.QName portTypeQName,
                                              javax.wsdl.Operation operation)
Gets input action. See section 3.3 of the 2004/08 WSA specification.

Parameters:
portTypeQName - Name of the port type
operation - Operation in the specified port type
Returns:
The operation input action URI

getOutputAction

public static java.lang.String getOutputAction(javax.xml.namespace.QName portTypeQName,
                                               javax.wsdl.Operation operation)
Gets output action. See section 3.3 of the 2004/08 WSA specification.

Parameters:
portTypeQName - Name of the port type
operation - Operation in the specified port type
Returns:
The operation output action URI

getNamespacePrefix

public static java.lang.String getNamespacePrefix(javax.xml.soap.SOAPElement element,
                                                  java.lang.String namespace)
                                           throws javax.xml.soap.SOAPException
Gets prefix for a given namespace. If the prefix is already defined for the namespace given, it is returned. Otherwise, a new prefix is automatically registered with the given namespace and returned.

Parameters:
element - Element where the prefix will be look up
namespace - Namespace to look up
Returns:
A namespace prefix
Throws:
javax.xml.soap.SOAPException

getAddressingNamespaceURI

public static java.lang.String getAddressingNamespaceURI()
Deprecated. 

Returns the namespace URI of the WSA version being used by the current request.

Returns:
The Addressing namespace URI

getAddressingNamespaceURI

public static java.lang.String getAddressingNamespaceURI(javax.xml.rpc.handler.MessageContext ctx)
Returns the namespace URI of the WSA version being used by the request in the specified message context.

Parameters:
ctx - The message context
Returns:
The Addressing namespace URI

getFaultActionURI

public static java.lang.String getFaultActionURI()
Deprecated. 

Returns the fault wsa:Action URI that is appropriate for the WSA version being used.

Returns:
The fault Action URI

getAnonymousRoleURI

public static java.lang.String getAnonymousRoleURI()
Deprecated. 

Returns the anonymous target URI that is appropriate for the WSA version being used.

Returns:
The anonymous target URI

getAnonymousRoleURI

public static java.lang.String getAnonymousRoleURI(javax.xml.rpc.handler.MessageContext ctx)
Returns the anonymous target URI that is appropriate for the WSA version being used.

Parameters:
ctx - Message Context
Returns:
The anonymous target URI

getResponseRelationshipType

public static javax.xml.namespace.QName getResponseRelationshipType()
Returns the response/reply relationship QName that is appropriate for the WSA version being used.

Returns:
The response/reply QName

getResponseRelationshipType

public static javax.xml.namespace.QName getResponseRelationshipType(javax.xml.rpc.handler.MessageContext ctx)
Returns the response/reply relationship QName that is appropriate for the WSA version being used.

Parameters:
ctx - Message context
Returns:
The response/reply QName

parseReference

public static EndpointReference parseReference(java.lang.String epr)
                                        throws java.lang.Exception
Parses a string containing an End-point reference in XML format, and translates it into an EndpointReference bean.

Parameters:
epr - End-point reference in XML format
Returns:
Bean instance
Throws:
java.lang.Exception - If the XML parser fails to initialize, a syntax error is detected in the input string, or a general error occurs while constructing the bean

toString

public static java.lang.String toString(EndpointReference epr,
                                        boolean prettyPrint)
                                 throws java.lang.Exception
Converts an End-Point Reference into an XML String.

Parameters:
epr - End-point reference
prettyPrint - Whether to beautify the generated XML text
Returns:
XML String
Throws:
java.lang.Exception - If an error occurs


Copyright © 2008-2009 Rodrigo Ruiz. All Rights Reserved.