Jakarta XML Web Services (JAX-WS) runtime implementation providing comprehensive SOAP web service capabilities
npx @tessl/cli install tessl/maven-com-sun-xml-ws--jaxws-rt@3.0.0JAX-WS Runtime (jaxws-rt) is a comprehensive implementation of Jakarta XML Web Services providing complete SOAP web service capabilities for Java applications. It serves as the reference implementation of the Jakarta Web Services specifications, offering high-performance enterprise web service functionality with support for SOAP message processing, WS-Policy, WS-Addressing, and multiple transport protocols.
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>3.0.2</version>
</dependency>// Core JAX-WS API (included as transitive dependency)
import jakarta.xml.ws.Service;
import jakarta.xml.ws.WebServiceFeature;
import jakarta.xml.ws.spi.Provider;
// JAX-WS RI specific APIs
import com.sun.xml.ws.api.WSBinding;
import com.sun.xml.ws.api.server.WSEndpoint;
import com.sun.xml.ws.api.client.ServiceInterceptor;Module system import (Java 9+):
module myapp {
requires com.sun.xml.ws;
}import jakarta.xml.ws.Service;
import jakarta.xml.ws.WebServiceFeature;
import com.sun.xml.ws.developer.JAXWSProperties;
// Create service from WSDL
URL wsdlLocation = new URL("http://localhost:8080/MyService?wsdl");
QName serviceName = new QName("http://example.com/", "MyService");
Service service = Service.create(wsdlLocation, serviceName);
// Get port with features
MyServiceInterface port = service.getPort(MyServiceInterface.class);
// Configure request context
Map<String, Object> requestContext = ((BindingProvider) port).getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/MyService");
// Make web service call
String result = port.myOperation("parameter");import jakarta.xml.ws.Endpoint;
import com.sun.xml.ws.api.server.WSEndpoint;
// Simple endpoint publishing
@WebService
public class MyServiceImpl {
@WebMethod
public String myOperation(String input) {
return "Processed: " + input;
}
}
// Publish endpoint
Endpoint endpoint = Endpoint.publish("http://localhost:8080/MyService", new MyServiceImpl());JAX-WS Runtime is built around several key architectural components:
The runtime aggregates five core modules: rt (core runtime), policy (WS-Policy), rt-fi (Fast Infoset), httpspi-servlet (HTTP SPI), and servlet (servlet container integration).
Central message processing APIs providing SOAP message abstraction, pipeline processing, and attachment handling. Forms the foundation for all web service communication.
// Message abstraction
package com.sun.xml.ws.api.message;
public abstract class Message {
public abstract boolean hasPayload();
public abstract Source readPayloadAsSource();
public abstract SOAPMessage readAsSOAPMessage() throws SOAPException;
public abstract void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException;
}
// Message container with metadata
public final class Packet {
public Message getMessage();
public void setMessage(Message msg);
public Map<String, Object> asMap();
public <T> T getSatellite(Class<T> satelliteClass);
}
// Pipeline processing
package com.sun.xml.ws.api.pipe;
public interface Tube {
NextAction processRequest(Packet request);
NextAction processResponse(Packet response);
void preDestroy();
}Server-side web service endpoint creation, lifecycle management, and request processing with support for various deployment scenarios.
// Root server processing object
package com.sun.xml.ws.api.server;
public abstract class WSEndpoint<T> {
public static <T> WSEndpoint<T> create(Class<T> implType, boolean processHandlerAnnotation,
Invoker invoker, QName serviceName, QName portName,
Container container, WSBinding binding,
SDDocumentSource primaryWsdl, Collection<? extends SDDocumentSource> metadata,
EntityResolver resolver, boolean isTransportSynchronous);
public abstract Codec createCodec();
public abstract ServiceDefinition getServiceDefinition();
public abstract SEIModel getSEIModel();
}
// Transport adapter
public abstract class Adapter<TK> {
public abstract ToolkitAdapter<TK> getToolkit();
public abstract void handle(TK toolkit) throws IOException;
}
// Container abstraction
public abstract class Container {
public abstract <T> T getSPI(Class<T> spiType);
}Client-side APIs for consuming web services with support for dynamic proxies, dispatch clients, and service interception.
// Service interception
package com.sun.xml.ws.api.client;
public interface ServiceInterceptor {
List<WebServiceFeature> preCreateBinding(WSPortInfo portInfo, List<WebServiceFeature> features);
void postCreateProxy(WSBindingProvider bindingProvider, Class<?> serviceEndpointInterface);
}
// Extended binding provider
package com.sun.xml.ws.developer;
public interface WSBindingProvider extends BindingProvider {
void setAddress(String address);
WSEndpointReference getWSEndpointReference();
WSPortInfo getPortInfo();
}WS-Policy implementation providing declarative configuration of web service capabilities, policy attachment, and assertion processing.
// Core policy representation
package com.sun.xml.ws.policy;
public final class Policy implements Iterable<AssertionSet> {
public static Policy createPolicy(PolicySourceModel model) throws PolicyException;
public boolean isEmpty();
public Iterator<AssertionSet> iterator();
public Policy normalize(boolean isClientAssertion);
}
// Policy assertions
public abstract class PolicyAssertion {
public abstract QName getName();
public abstract AssertionData getData();
public abstract boolean isOptional();
public abstract boolean isPrivate();
}
// Policy map for storage
public final class PolicyMap {
public Policy getEndpointEffectivePolicy(PolicyMapKey key) throws PolicyException;
public Policy getOperationEffectivePolicy(PolicyMapKey key) throws PolicyException;
public Policy getPortEffectivePolicy(PolicyMapKey key) throws PolicyException;
}HTTP transport implementation and servlet container integration with support for various hosting scenarios.
// HTTP transport
package com.sun.xml.ws.transport.http;
public final class HttpAdapter extends Adapter<HttpConnection> {
public static HttpAdapter createAlone(WSEndpoint<?> endpoint, Map<String, String> urlPattern);
public void handle(HttpConnection connection) throws IOException;
}
// Servlet integration
package com.sun.xml.ws.transport.http.servlet;
public final class WSServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException;
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException;
}XML-to-Java databinding with JAXB integration and support for custom databinding providers.
// Core databinding interface
package com.oracle.webservices.api.databinding;
public interface Databinding {
EndpointCallBridge createCallBridge(JavaCallInfo callInfo);
ClientCallBridge createCallBridge(JavaCallInfo callInfo);
void generateWSDL(WSDLGenInfo wsdlGenInfo);
}
// Databinding factory
public abstract class DatabindingFactory {
public static DatabindingFactory newInstance();
public abstract Databinding createDatabinding(DatabindingConfig config);
}
// SPI for custom providers
package com.sun.xml.ws.spi.db;
public interface DatabindingProvider {
boolean isFor(String databindingMode);
void init(Map<String, Object> properties);
Databinding create(DatabindingConfig config);
}Advanced developer APIs providing fine-grained control over JAX-WS behavior, streaming, validation, and custom features.
// JAX-WS RI properties
package com.sun.xml.ws.developer;
public final class JAXWSProperties {
public static final String CONTENT_NEGOTIATION_PROPERTY = "com.sun.xml.ws.client.ContentNegotiation";
public static final String MTOM_THRESHOLOD_VALUE = "com.sun.xml.ws.common.MtomThresholdValue";
public static final String HTTP_EXCHANGE = "com.sun.xml.ws.http.exchange";
}
// Extended binding provider
public interface WSBindingProvider extends BindingProvider {
void setAddress(String address);
WSEndpointReference getWSEndpointReference();
WSPortInfo getPortInfo();
}
// Streaming attachment feature
@WebServiceFeature.ID("http://java.sun.com/xml/ns/jaxws/")
public final class StreamingAttachmentFeature extends WebServiceFeature {
public StreamingAttachmentFeature(String dir, boolean parseEagerly, long memoryThreshold);
public String getDir();
public boolean isParseEagerly();
public long getMemoryThreshold();
}WS-Addressing implementation supporting both W3C and Member Submission specifications for message addressing and correlation.
// Addressing version support
package com.sun.xml.ws.api.addressing;
public enum AddressingVersion {
W3C("http://www.w3.org/2005/08/addressing"),
MEMBER("http://schemas.xmlsoap.org/ws/2004/08/addressing");
public String getNsUri();
public QName getWsdlExtensionAttribute();
public String getPrefix();
}
// Endpoint reference
public final class WSEndpointReference {
public WSEndpointReference(Source eprInfoset, AddressingVersion version);
public Source asSource(String localName);
public WSEndpointReference createWithAddress(String address);
}// Binding representation
package com.sun.xml.ws.api;
public interface WSBinding extends Binding {
SOAPVersion getSOAPVersion();
AddressingVersion getAddressingVersion();
boolean isFeatureEnabled(Class<? extends WebServiceFeature> feature);
<F extends WebServiceFeature> F getFeature(Class<F> featureType);
}
// SOAP version constants
public enum SOAPVersion {
SOAP_11("http://schemas.xmlsoap.org/soap/", "1.1"),
SOAP_12("http://www.w3.org/2003/05/soap-envelope", "1.2");
public String getHttpContentType();
public String getHttpBindingId();
public QName getFaultCodeClientLocalName();
}
// Attachment representation
package com.sun.xml.ws.api.message;
public interface Attachment {
String getContentId();
String getContentType();
byte[] asByteArray();
DataHandler asDataHandler();
Source asSource();
InputStream asInputStream();
}// Policy exceptions
package com.sun.xml.ws.policy;
public class PolicyException extends Exception {
public PolicyException(String message);
public PolicyException(String message, Throwable cause);
}
// Web service exceptions
package com.sun.xml.ws.util.exception;
public abstract class JAXWSExceptionBase extends WebServiceException implements Localizable {
protected JAXWSExceptionBase(String key, Object... args);
protected JAXWSExceptionBase(Throwable throwable);
}JAX-WS Runtime provides extensive customization through Service Provider Interfaces:
// Custom binding types
package com.sun.xml.ws.api;
public abstract class BindingIDFactory {
public abstract BindingID parse(String lexical) throws WebServiceException;
}
// Custom transport implementations
package com.sun.xml.ws.api.pipe;
public abstract class TransportTubeFactory {
public abstract Tube doCreate(ClientTubeAssemblerContext context);
}
// Custom tubeline assembly
public abstract class TubelineAssemblerFactory {
public abstract TubelineAssembler doCreate(BindingID bindingId);
}
// Custom policy assertions
package com.sun.xml.ws.policy.spi;
public interface PolicyAssertionCreator {
String[] getSupportedDomainNamespaceURIs();
PolicyAssertion createAssertion(AssertionData data, Collection<PolicyAssertion> nestedPolicy);
}The runtime provides standard implementations for:
com.sun.xml.ws.spi.ProviderImplcom.sun.xml.ws.db.DatabindingProviderImplcom.sun.xml.ws.db.glassfish.JAXBRIContextFactorycom.sun.xml.ws.policy.jaxws.XmlWsLoggingProvider