10 Publishing a Web Service Endpoint

The javax.xml.ws.Endpoint API (see http://download.oracle.com/javaee/5/api/javax/xml/ws/Endpoint.html) enables you to create a Web service endpoint at runtime without deploying the Web service to a WebLogic Server instance.

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

Table 10-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://download.oracle.com/javaee/5/api/javax/xml/ws/Endpoint.html.