11 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 10.3.6 instance using the javax.xml.ws.Endpoint API.

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

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

Table 11-1 Steps to Publish a Web Service Endpoint

#
Step Description

1

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());

2

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
context.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
callbackImpl.publish(sc);

3

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:

callbackImpl.stop()

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/5/api/javax/xml/ws/Endpoint.html.