Jakarta XML Web Services (JAX-WS) runtime implementation providing comprehensive SOAP web service capabilities
—
Server-side web service endpoint creation, lifecycle management, request processing, and deployment integration with support for various hosting scenarios including standalone, servlet containers, and application servers.
Core server-side processing object providing complete web service endpoint functionality.
/**
* Root server-side processing object that represents a web service endpoint.
* Implements ComponentRegistry and ComponentEx interfaces.
*/
package com.sun.xml.ws.api.server;
public abstract class WSEndpoint<T> implements ComponentRegistry, ComponentEx {
/** Create endpoint from implementation class with full configuration */
public static <T> WSEndpoint<T> create(
Class<T> implType, // Implementation class
boolean processHandlerAnnotation, // Process @HandlerChain annotations
Invoker invoker, // Service instance invoker
QName serviceName, // WSDL service name
QName portName, // WSDL port name
Container container, // Runtime container
WSBinding binding, // Protocol binding
SDDocumentSource primaryWsdl, // Primary WSDL document
Collection<? extends SDDocumentSource> metadata, // Additional metadata
EntityResolver resolver, // XML entity resolver
boolean isTransportSynchronous // Transport synchronization
);
/** Create endpoint from existing endpoint with new binding */
public static <T> WSEndpoint<T> create(WSEndpoint<T> endpoint, WSBinding binding);
/** Get implementation class */
public abstract @NotNull Class<T> getImplementationClass();
/** Get codec for message encoding/decoding */
public abstract @NotNull Codec createCodec();
/** Get complete service definition including WSDL */
public abstract @Nullable ServiceDefinition getServiceDefinition();
/** Get service endpoint interface model */
public abstract @Nullable SEIModel getSEIModel();
/** Get protocol binding */
public abstract @NotNull WSBinding getBinding();
/** Get runtime container */
public abstract @NotNull Container getContainer();
/** Get port name */
public abstract @NotNull QName getPortName();
/** Get service name */
public abstract @NotNull QName getServiceName();
/** Get WSDL port information */
public abstract @Nullable WSDLPort getPort();
/** Set executor for async processing */
public abstract void setExecutor(@NotNull Executor exec);
/** Schedule packet for async processing */
public abstract void schedule(@NotNull Packet request, @NotNull CompletionCallback callback);
/** Create processing pipeline head */
public abstract @NotNull PipeHead createPipeHead();
/** Get engine (may throw UnsupportedOperationException) */
public Engine getEngine();
/** Get bound endpoints */
public List<BoundEndpoint> getBoundEndpoints();
/** Get all registered components */
public abstract @NotNull Set<Component> getComponents();
/** Get service provider interface implementation */
public abstract @Nullable <S> S getSPI(@NotNull Class<S> spiType);
/** Get managed object manager */
public abstract @NotNull ManagedObjectManager getManagedObjectManager();
/** Close managed object manager */
public abstract void closeManagedObjectManager();
/** Get tube assembler context */
public abstract @NotNull ServerTubeAssemblerContext getAssemblerContext();
/** Get operation dispatcher */
public @Nullable OperationDispatcher getOperationDispatcher();
/** Dispose endpoint and clean up resources */
public abstract void dispose();
/** Get endpoint reference */
public abstract WSEndpointReference getEndpointReference(Class<? extends EndpointReference> clazz,
String address, String wsdlAddress,
Element... referenceParameters);
/** Create service response for exception */
public Packet createServiceResponseForException(ThrowableContainerPropertySet tc,
Packet responsePacket,
SOAPVersion soapVersion,
WSDLPort wsdlPort,
SEIModel seiModel,
WSBinding binding);
}Transport-specific adapters that bridge between endpoints and various transport protocols.
/**
* Transport-specific adapter for handling protocol-specific requests
*/
public abstract class Adapter<TK> {
/** Get toolkit-specific adapter implementation */
public abstract ToolkitAdapter<TK> getToolkit();
/** Handle incoming request using transport toolkit */
public abstract void handle(TK connection) throws IOException;
/** Get associated endpoint */
public WSEndpoint<?> getEndpoint();
/** Get URL pattern for adapter */
public String getUrlPattern();
}
/**
* HTTP-specific adapter implementation
*/
package com.sun.xml.ws.transport.http;
public final class HttpAdapter extends Adapter<WSHTTPConnection> {
/** Create standalone HTTP adapter */
public static HttpAdapter createAlone(WSEndpoint<?> endpoint, Map<String, String> urlPattern);
/** Handle HTTP connection */
public void handle(WSHTTPConnection connection) throws IOException;
/** Get HTTP metadata document */
public void publishWSDL(WSHTTPConnection connection) throws IOException;
}Container abstraction for integration with various runtime environments.
/**
* Runtime container abstraction providing services and lifecycle management
*/
public abstract class Container {
/** Get container-specific service implementation */
public abstract <T> T getSPI(Class<T> spiType);
/** Get components of specified type */
public <T> Iterable<Component<T>> getComponents(Class<T> componentType);
/** Default container implementation */
public static final Container NONE = new Container() {
public <T> T getSPI(Class<T> spiType) { return null; }
};
}
/**
* Container resolver for discovering container implementations
*/
public abstract class ContainerResolver {
/** Get container for current thread */
public static Container getContainer();
/** Set container for current thread */
public static void setContainer(Container container);
/** Get default container implementation */
public abstract Container getContainer(Class<?> endpointClass) throws WebServiceException;
}Lifecycle management for web service implementation instances.
/**
* Manages lifecycle of service implementation instances
*/
public abstract class InstanceResolver<T> {
/** Resolve service instance for request */
public abstract T resolve(Packet request);
/** Dispose service instance after request */
public abstract void dispose(T instance);
/** Create singleton instance resolver */
public static <T> InstanceResolver<T> createSingleton(T singleton);
/** Create resolver that creates new instance per request */
public static <T> InstanceResolver<T> createFromInstanceResolverAnnotation(Class<T> clazz);
/** Create resolver using specific factory */
public static <T> InstanceResolver<T> createDefault(Class<T> clazz, boolean hasDefaultConstructor);
}
/**
* Service method invocation abstraction
*/
public interface Invoker {
/** Invoke service method with packet context */
Object invoke(Packet request, Method method, Object... args) throws
IllegalAccessException, IllegalArgumentException, InvocationTargetException;
/** Invoke method on specific instance */
<T> T invoke(Packet request, Object instance, Method method, Object... args) throws
IllegalAccessException, IllegalArgumentException, InvocationTargetException;
}Service description including WSDL and schema documents.
/**
* Service description document (WSDL, schema, etc.)
*/
public abstract class SDDocument {
/** Get document URL */
public abstract URL getURL();
/** Get document as Source */
public abstract Source read() throws IOException, SAXException;
/** Get document as InputStream */
public abstract InputStream read() throws IOException;
/** Check if document is WSDL */
public abstract boolean isWSDL();
/** Check if document is schema */
public abstract boolean isSchema();
/** Get target namespace */
public abstract QName getRootName();
}
/**
* Complete service definition including all metadata documents
*/
public interface ServiceDefinition extends Iterable<SDDocument> {
/** Get primary WSDL document */
SDDocument getPrimary();
/** Filter documents by criteria */
Iterable<SDDocument> filter(SDDocumentFilter filter);
/** Add schema resolver */
void addFilter(SDDocumentFilter filter);
}
/**
* Source for service description documents
*/
public abstract class SDDocumentSource {
/** Get document URL */
public abstract URL getSystemId();
/** Read document as Source */
public abstract Source read() throws IOException, SAXException;
/** Create from URL */
public static SDDocumentSource create(URL url);
/** Create from Source */
public static SDDocumentSource create(URL systemId, Source source);
}Simplified endpoint publishing for standalone deployments.
/**
* HTTP endpoint publishing utilities
*/
package com.sun.xml.ws.transport.http;
public final class HttpEndpoint {
/** Publish endpoint at HTTP address */
public static HttpEndpoint publish(String address, Object implementor);
/** Publish with executor service */
public static HttpEndpoint publish(String address, Object implementor, Executor executor);
/** Stop endpoint */
public void stop();
/** Check if endpoint is stopped */
public boolean isStopped();
}Usage Examples:
import com.sun.xml.ws.api.server.*;
import com.sun.xml.ws.transport.http.*;
// Create endpoint programmatically
@WebService
public class CalculatorImpl {
@WebMethod
public int add(int a, int b) {
return a + b;
}
}
// Create endpoint with full configuration
Class<CalculatorImpl> implClass = CalculatorImpl.class;
Invoker invoker = InstanceResolver.createDefault(implClass, true).createInvoker();
QName serviceName = new QName("http://example.com/", "CalculatorService");
QName portName = new QName("http://example.com/", "CalculatorPort");
WSBinding binding = BindingImpl.create(BindingID.SOAP11_HTTP);
WSEndpoint<CalculatorImpl> endpoint = WSEndpoint.create(
implClass,
true, // Process handler annotations
invoker,
serviceName,
portName,
Container.NONE, // No container
binding,
null, // No primary WSDL
Collections.emptyList(), // No metadata
null, // No entity resolver
true // Synchronous transport
);
// Create HTTP adapter
HttpAdapter adapter = HttpAdapter.createAlone(endpoint, Collections.emptyMap());
// Publish endpoint
HttpEndpoint httpEndpoint = HttpEndpoint.publish("http://localhost:8080/calculator", adapter);
// Custom container with services
Container customContainer = new Container() {
@SuppressWarnings("unchecked")
public <T> T getSPI(Class<T> spiType) {
if (spiType == MyCustomService.class) {
return (T) new MyCustomServiceImpl();
}
return null;
}
};
// Use custom instance resolver
InstanceResolver<CalculatorImpl> resolver = new InstanceResolver<CalculatorImpl>() {
public CalculatorImpl resolve(Packet request) {
// Custom instance creation logic
return new CalculatorImpl();
}
public void dispose(CalculatorImpl instance) {
// Custom cleanup logic
}
};Install with Tessl CLI
npx tessl i tessl/maven-com-sun-xml-ws--jaxws-rt