Configuring the Context Path of the Asynchronous Response Endpoint

Invoking Web Services Asynchronously 3-13

3.5.1.3 Configuring the Context Path of the Asynchronous Response Endpoint

When a client is running within a servlet or Web application-based Web service, it can use its ServletContext and context path to construct the asynchronous response endpoint. You pass the information as an argument to the AsyncClientTransportFeature, as follows: ■ When running inside a servlet: AsyncClientTransportFeature asyncFeature = new AsyncClientTransportFeaturegetServletContext; ■ When running inside a Web service or an EJB-based Web service: import com.sun.xml.ws.api.server.Container; ... Container c = ContainerResolver.getInstance.getContainer; ServletContext servletContext = c.getSPIServletContext.class; AsyncClientTransportFeature asyncFeature = new AsyncClientTransportFeatureservletContext; The specified context must be scoped within the current application or refer to an unused context; it cannot refer to a context that is scoped to another deployed application. The following tables summarizes the constructors that can be used to configure the context path of the asynchronous response endpoint. AsyncClientTransportFeaturejavax.xml.ws. wsaddressing.W3CEndpointReference replyTo , javax.xml.ws.wsaddressing.W3CEndpointRefe rence faultTo, boolean doPublish Configures the following: ■ Endpoint reference address for the outgoing ReplyTo and FaultTo headers. ■ Whether to publish the endpoint at the specified address. For more information, see Section 3.5.1.4, Publishing the Asynchronous Response Endpoint . AsyncClientTransportFeaturejavax.xml.ws. wsaddressing.W3CEndpointReference replyTo , javax.xml.ws.wsaddressing.W3CEndpointRefe rence faultTo, boolean doPublish, boolean useAsyncWithSyncInvoke Configures the following: ■ Endpoint reference address for the outgoing ReplyTo and FaultTo headers. ■ Whether to publish the endpoint at the specified address. For more information, see Section 3.5.1.4, Publishing the Asynchronous Response Endpoint . ■ Whether to enable asynchronous client transport for synchronous operations. For more information, see Section 3.5.1.5, Configuring Asynchronous Client Transport for Synchronous Operations . Note: When you use the empty constructor for AsyncClientTransportFeature, the Web services runtime attempts to discover the container in which the current feature was instantiated and publish the endpoint using any available container context. Table 3–6 Cont. Constructors for Configuring the ReplyTo and FaultTo Headers Constructor Description 3-14 Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server

3.5.1.4 Publishing the Asynchronous Response Endpoint