Jakarta XML Web Services (JAX-WS) runtime implementation providing comprehensive SOAP web service capabilities
—
WS-Addressing implementation supporting both W3C and Member Submission specifications for message addressing, correlation, and endpoint reference management. Provides comprehensive addressing capabilities for enterprise web service communication.
Core addressing version abstractions supporting multiple WS-Addressing specifications.
/**
* WS-Addressing version enumeration with specification support
*/
package com.sun.xml.ws.api.addressing;
public enum AddressingVersion {
/** W3C WS-Addressing specification */
W3C("http://www.w3.org/2005/08/addressing", "wsa", "http://www.w3.org/2005/08/addressing/wsdl"),
/** Member Submission WS-Addressing specification */
MEMBER("http://schemas.xmlsoap.org/ws/2004/08/addressing", "wsa", "http://schemas.xmlsoap.org/ws/2004/08/addressing");
/** Get namespace URI for this addressing version */
public String getNsUri();
/** Get default namespace prefix */
public String getPrefix();
/** Get WSDL extension namespace */
public String getWsdlNsUri();
/** Get WSDL extension attribute for addressing requirement */
public QName getWsdlExtensionAttribute();
/** Get Action header QName */
public QName getActionTag();
/** Get To header QName */
public QName getToTag();
/** Get From header QName */
public QName getFromTag();
/** Get ReplyTo header QName */
public QName getReplyToTag();
/** Get FaultTo header QName */
public QName getFaultToTag();
/** Get MessageID header QName */
public QName getMessageIDTag();
/** Get RelatesTo header QName */
public QName getRelatesToTag();
/** Check if given namespace URI matches this version */
public boolean isNsUri(String nsUri);
}Endpoint reference abstraction with support for both addressing specifications.
/**
* WS-Addressing endpoint reference implementation
*/
public final class WSEndpointReference {
/** Create endpoint reference from Source */
public WSEndpointReference(Source eprInfoset, AddressingVersion version);
/** Create from JAX-WS EndpointReference */
public WSEndpointReference(EndpointReference epr, AddressingVersion version);
/** Create with address only */
public WSEndpointReference(String address, AddressingVersion version);
/** Get endpoint reference as Source */
public Source asSource(String rootTagName);
/** Convert to JAX-WS EndpointReference */
public <T extends EndpointReference> T asEndpointReference(Class<T> clazz);
/** Create new endpoint reference with different address */
public WSEndpointReference createWithAddress(String address);
/** Get endpoint address */
public String getAddress();
/** Get addressing version */
public AddressingVersion getVersion();
/** Get reference parameters */
public Header[] getReferenceParameters();
/** Get metadata */
public List<Element> getMetadata();
/** Check if endpoint reference has metadata */
public boolean hasMetadata();
/** Create addressing headers for message */
public void addReferenceParametersToList(HeaderList headers);
}Header creation and management for WS-Addressing message headers.
/**
* Factory for creating WS-Addressing headers
*/
public final class AddressingUtils {
/** Create Action header */
public static Header createActionHeader(AddressingVersion version, String action);
/** Create To header */
public static Header createToHeader(AddressingVersion version, String to);
/** Create From header */
public static Header createFromHeader(AddressingVersion version, WSEndpointReference from);
/** Create ReplyTo header */
public static Header createReplyToHeader(AddressingVersion version, WSEndpointReference replyTo);
/** Create FaultTo header */
public static Header createFaultToHeader(AddressingVersion version, WSEndpointReference faultTo);
/** Create MessageID header */
public static Header createMessageIDHeader(AddressingVersion version, String messageId);
/** Create RelatesTo header */
public static Header createRelatesToHeader(AddressingVersion version, String relatesTo, String relationshipType);
/** Get anonymous address for version */
public static String getAnonymousAddress(AddressingVersion version);
/** Get none address for version */
public static String getNoneAddress(AddressingVersion version);
/** Check if address is anonymous */
public static boolean isAnonymous(AddressingVersion version, String address);
/** Check if address is none */
public static boolean isNone(AddressingVersion version, String address);
}Support for one-way messaging patterns with addressing.
/**
* Feature for one-way message support with addressing
*/
public final class OneWayFeature extends WebServiceFeature {
/** Feature ID constant */
public static final String ID = "http://java.sun.com/xml/ns/jaxws/addressing/oneway";
/** Default constructor enabling one-way support */
public OneWayFeature();
/** Constructor with enable/disable flag */
public OneWayFeature(boolean enabled);
/** Constructor with ReplyTo address */
public OneWayFeature(boolean enabled, WSEndpointReference replyTo);
/** Get ReplyTo endpoint reference */
public WSEndpointReference getReplyTo();
/** Get feature ID */
public String getID();
}Pipeline tubes for processing WS-Addressing headers on client and server sides.
/**
* Server-side WS-Addressing processing tube
*/
package com.sun.xml.ws.addressing;
public final class WsaServerTube extends AbstractFilterTubeImpl {
/** Create server addressing tube */
public WsaServerTube(WSEndpoint<?> endpoint, WSDLPort wsdlPort, WSBinding binding, Tube next);
/** Process request with addressing headers */
public NextAction processRequest(Packet request);
/** Process response with addressing headers */
public NextAction processResponse(Packet response);
/** Get addressing version */
public AddressingVersion getAddressingVersion();
/** Check if addressing is required */
public boolean isAddressingRequired();
}
/**
* Client-side WS-Addressing processing tube
*/
public final class WsaClientTube extends AbstractFilterTubeImpl {
/** Create client addressing tube */
public WsaClientTube(WSDLPort wsdlPort, WSBinding binding, Tube next);
/** Process outbound request */
public NextAction processRequest(Packet request);
/** Process inbound response */
public NextAction processResponse(Packet response);
/** Get addressing version */
public AddressingVersion getAddressingVersion();
}Specific support for Member Submission WS-Addressing specification.
/**
* Member Submission addressing constants
*/
package com.sun.xml.ws.addressing.v200408;
public final class MemberSubmissionAddressingConstants {
/** Member Submission namespace URI */
public static final String WSA_NAMESPACE_NAME = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
/** Anonymous address URI */
public static final String WSA_ANONYMOUS_ADDRESS = WSA_NAMESPACE_NAME + "/role/anonymous";
/** Action header name */
public static final QName WSA_ACTION_NAME = new QName(WSA_NAMESPACE_NAME, "Action");
/** To header name */
public static final QName WSA_TO_NAME = new QName(WSA_NAMESPACE_NAME, "To");
/** From header name */
public static final QName WSA_FROM_NAME = new QName(WSA_NAMESPACE_NAME, "From");
/** ReplyTo header name */
public static final QName WSA_REPLYTO_NAME = new QName(WSA_NAMESPACE_NAME, "ReplyTo");
/** FaultTo header name */
public static final QName WSA_FAULTTO_NAME = new QName(WSA_NAMESPACE_NAME, "FaultTo");
/** MessageID header name */
public static final QName WSA_MESSAGEID_NAME = new QName(WSA_NAMESPACE_NAME, "MessageID");
/** RelatesTo header name */
public static final QName WSA_RELATESTO_NAME = new QName(WSA_NAMESPACE_NAME, "RelatesTo");
}
/**
* Member Submission server-side addressing tube
*/
public final class MemberSubmissionWsaServerTube extends AbstractFilterTubeImpl {
/** Create MS server addressing tube */
public MemberSubmissionWsaServerTube(WSEndpoint<?> endpoint, WSDLPort wsdlPort, WSBinding binding, Tube next);
/** Process request with MS addressing */
public NextAction processRequest(Packet request);
/** Process response with MS addressing */
public NextAction processResponse(Packet response);
}
/**
* Member Submission client-side addressing tube
*/
public final class MemberSubmissionWsaClientTube extends AbstractFilterTubeImpl {
/** Create MS client addressing tube */
public MemberSubmissionWsaClientTube(WSDLPort wsdlPort, WSBinding binding, Tube next);
/** Process outbound request */
public NextAction processRequest(Packet request);
/** Process inbound response */
public NextAction processResponse(Packet response);
}Integration between WS-Addressing and WS-Policy for declarative configuration.
/**
* Policy-based addressing feature configurator
*/
package com.sun.xml.ws.addressing.policy;
public final class AddressingFeatureConfigurator implements PolicyFeatureConfigurator {
/** Get supported policy assertions */
public Collection<QName> getSupportedAssertions();
/** Configure addressing features from policy */
public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException;
}
/**
* Addressing policy validator
*/
public final class AddressingPolicyValidator implements PolicyAssertionValidator {
/** Validate client-side addressing policy */
public Fitness validateClientSide(PolicyAssertion assertion);
/** Validate server-side addressing policy */
public Fitness validateServerSide(PolicyAssertion assertion);
/** Get supported domains */
public String[] declareSupportedDomains();
}Utility methods for working with addressing headers and endpoint references.
/**
* Utility methods for endpoint reference operations
*/
public final class EndpointReferenceUtil {
/** Create endpoint reference from WSDL port */
public static WSEndpointReference getEndpointReference(WSDLPort wsdlPort, AddressingVersion version, String address);
/** Transform endpoint reference */
public static WSEndpointReference transform(Class<? extends EndpointReference> clazz, WSEndpointReference epr);
/** Get address from endpoint reference Source */
public static String getAddress(Source eprInfoset, AddressingVersion version);
/** Extract reference parameters */
public static List<Element> getReferenceParameters(Source eprInfoset, AddressingVersion version);
/** Create endpoint reference Source */
public static Source createEndpointReferenceSource(String address, QName serviceName, QName portName,
List<Element> referenceParameters, String wsdlAddress,
AddressingVersion version);
}Usage Examples:
import com.sun.xml.ws.api.addressing.*;
import com.sun.xml.ws.addressing.*;
import com.sun.xml.ws.addressing.v200408.*;
// Create endpoint reference
String serviceAddress = "http://example.com/service";
WSEndpointReference epr = new WSEndpointReference(serviceAddress, AddressingVersion.W3C);
// Create endpoint reference with metadata
QName serviceName = new QName("http://example.com/", "MyService");
QName portName = new QName("http://example.com/", "MyPort");
List<Element> referenceParameters = new ArrayList<>();
Source eprSource = EndpointReferenceUtil.createEndpointReferenceSource(
serviceAddress, serviceName, portName, referenceParameters,
"http://example.com/service?wsdl", AddressingVersion.W3C);
WSEndpointReference customEpr = new WSEndpointReference(eprSource, AddressingVersion.W3C);
// Create addressing headers
Header actionHeader = AddressingUtils.createActionHeader(AddressingVersion.W3C, "http://example.com/ProcessData");
Header toHeader = AddressingUtils.createToHeader(AddressingVersion.W3C, serviceAddress);
Header messageIdHeader = AddressingUtils.createMessageIDHeader(AddressingVersion.W3C, UUID.randomUUID().toString());
// Create ReplyTo header with endpoint reference
WSEndpointReference replyToEpr = new WSEndpointReference("http://client.example.com/callback", AddressingVersion.W3C);
Header replyToHeader = AddressingUtils.createReplyToHeader(AddressingVersion.W3C, replyToEpr);
// Add headers to message
HeaderList headers = new HeaderList();
headers.add(actionHeader);
headers.add(toHeader);
headers.add(messageIdHeader);
headers.add(replyToHeader);
// Service with addressing enabled
@WebService
@Addressing(enabled = true, required = true)
public class AddressingEnabledService {
@WebMethod
public String processData(@WebParam(name = "data") String data, @Resource WebServiceContext context) {
// Access addressing headers
MessageContext msgContext = context.getMessageContext();
HeaderList inboundHeaders = (HeaderList) msgContext.get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY);
// Get Action header
Header actionHeader = inboundHeaders.get(AddressingVersion.W3C.getActionTag(), false);
if (actionHeader != null) {
String action = actionHeader.getStringContent();
System.out.println("Action: " + action);
}
// Get MessageID for correlation
Header messageIdHeader = inboundHeaders.get(AddressingVersion.W3C.getMessageIDTag(), false);
if (messageIdHeader != null) {
String messageId = messageIdHeader.getStringContent();
// Use messageId for response correlation
}
return "Processed: " + data;
}
}
// Client with addressing
MyService service = new MyService();
MyServiceInterface port = service.getMyServicePort(new AddressingFeature(true, true));
// Set ReplyTo for asynchronous response
WSBindingProvider wsBP = (WSBindingProvider) port;
WSEndpointReference callbackEpr = new WSEndpointReference("http://client.example.com/callback", AddressingVersion.W3C);
// Create custom headers for request
Header replyToHeader = AddressingUtils.createReplyToHeader(AddressingVersion.W3C, callbackEpr);
wsBP.setOutboundHeaders(replyToHeader);
// Make service call
String result = port.processData("test data");
// Member Submission addressing usage
@WebService
@MemberSubmissionAddressing(enabled = true, required = true)
public class MSAddressingService {
@WebMethod
public void processOneWay(@WebParam(name = "data") String data, @Resource WebServiceContext context) {
// Process one-way message with MS addressing
MessageContext msgContext = context.getMessageContext();
HeaderList headers = (HeaderList) msgContext.get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY);
// Get MS addressing headers
Header actionHeader = headers.get(MemberSubmissionAddressingConstants.WSA_ACTION_NAME, false);
if (actionHeader != null) {
String action = actionHeader.getStringContent();
System.out.println("MS Action: " + action);
}
}
}
// One-way feature usage
WSEndpointReference replyTo = new WSEndpointReference("http://client.example.com/callback", AddressingVersion.W3C);
OneWayFeature oneWayFeature = new OneWayFeature(true, replyTo);
MyServiceInterface port = service.getMyServicePort(
new AddressingFeature(true, true),
oneWayFeature
);
// Custom addressing tube
public class CustomAddressingTube extends AbstractFilterTubeImpl {
private AddressingVersion addressingVersion;
public CustomAddressingTube(AddressingVersion version, Tube next) {
super(next);
this.addressingVersion = version;
}
public NextAction processRequest(Packet request) {
// Add custom addressing logic
Message message = request.getMessage();
HeaderList headers = message.getHeaders();
// Add custom correlation ID
String correlationId = generateCorrelationId();
Header correlationHeader = Headers.create(
new QName("http://example.com/correlation", "CorrelationID"),
correlationId);
headers.add(correlationHeader);
return doInvoke(next, request);
}
public NextAction processResponse(Packet response) {
// Process response addressing headers
return doReturnWith(response);
}
}
// Policy-based addressing configuration
// WS-Policy assertion in WSDL would automatically enable addressing
/*
<wsp:Policy>
<wsam:Addressing>
<wsp:Policy>
<wsam:Required/>
</wsp:Policy>
</wsam:Addressing>
</wsp:Policy>
*/
// The AddressingFeatureConfigurator automatically processes this policy
// and enables AddressingFeature with required=trueInstall with Tessl CLI
npx tessl i tessl/maven-com-sun-xml-ws--jaxws-rt