28 Publishing a Web Service Endpoint

This chapter describes how to create a web service endpoint at runtime without deploying the web service to a WebLogic Server instance using the javax.xml.ws.Endpoint API.

For more information, see http://docs.oracle.com/javaee/7/api/javax/xml/ws/Endpoint.html.

The following table summarizes the steps to publish a web service endpoint.

Table 28-1 Steps to Publish a Web Service Endpoint

# Step Description


Create a web service endpoint.

Use the javax.xml.ws.Endpoint create() method to create the endpoint, specify the implementor (that is, the web service implementation) to which the endpoint is associated, and optionally specify the binding type. If not specified, the binding type defaults to SOAP1.1/HTTP. The endpoint is associated with only one implementation object and one javax.xml.ws.Binding, as defined at runtime; these values cannot be changed.

For example, the following example creates a web service endpoint for the CallbackWS() implementation.

Endpoint callbackImpl = Endpoint.create(new CallbackWS());


Publish the web service endpoint to accept incoming requests.

Use the javax.xml.ws.Endpoint publish() method to specify the server context, or the address and optionally the implementor of the web service endpoint.

Note: If you wish to update the metadata documents (WSDL or XML schema) associated with the endpoint, you must do so before publishing the endpoint.

For example, the following example publishes the web service endpoint created in Step 1 using the server context.

Object sc


Stop the web service endpoint to shut it down and prevent additional requests after processing is complete.

Use the javax.xml.ws.Endpoint stop() method to shut down the endpoint and stop accepting incoming requests. Once stopped, an endpoint cannot be republished.

For example:


For an example of publishing a web service endpoint within the context of a callback example, see Programming Guidelines for the Callback Client Web Service.

In addition to the steps described in the previous table, you can defined the following using the javax.xml.ws.Endpoint API methods:

For more information, see the javax.xml.ws.Endpoint Javadoc at http://docs.oracle.com/javaee/7/api/javax/xml/ws/Endpoint.html.