WebSphere Application Server provides interfaces for you to create
endpoint references. Endpoint references are a primary concept of the Web
Services Addressing (WS-Addressing) interoperability protocol, and provide
a standard mechanism to encapsulate information about specific Web service
endpoints.
About this task
Perform this task if you are writing an application that uses the
WS-Addressing support provided by WebSphere Application Server. Such applications
require endpoint references to target Web service endpoints. When you are
writing the application, you might not know the address of the endpoint, because
the address can change when the application is deployed. Using the WS-Addressing
support, you can either specify the endpoint address, or allow WebSphere Application
Server to generate it for you at run time.
Procedure
Create an endpoint reference by performing one of the following
steps.
- To create an endpoint reference with an address that you specify directly,
use the WS-Addressing EndpointReferenceManager.createEndpointReference(URI
address) method of the system programming interface (SPI) provided. This method
is useful in test scenarios, where the address of the service does not change.
- To create an endpoint reference with an address that is automatically
generated by WebSphere Application Server, perform the following steps.
- If you created the Web service deployment descriptor file, webservices.xml,
manually, ensure that the webservice-description-name in the file is the same
as the local part of the Web Services Description Language (WSDL) service
name. If you generated the webservices.xml file using the tools provided,
the names match by default. This match is required for the generation of the
correct URI for the endpoint reference.
Create
the endpoint reference using the method that is appropriate for the object
that the reference will represent:
- If you are creating an endpoint reference to represent a stateful session
bean that maintains in-memory state, create the endpoint reference using the
EndpointReferenceManager.createEndpointReference(QName serviceName, String
endpointName, Remote statefulSessionBean) method of the application programming
interface (API) provided. This method ensures that requests are targeted at
the specific server that hosts the stateful session bean instance, and are
not workload-managed.
- If you are creating an endpoint reference to represent any other object,
create the endpoint reference using the EndpointReferenceManager.createEndpointReference(QName
serviceName, String endpointName) method of the API. The combination of service
name and endpoint name must be unique in the server. If there is more than
one Web service application with the same service name and endpoint name,
the application server cannot generate a unique URI object for the endpoint.
If you cannot ensure that the combination of service name and endpoint name
is unique, use an SPI method to create the endpoint reference.
When the application invokes either of the previous two methods, WebSphere
Application Server generates the address URI for the endpoint reference, and
puts the service name and endpoint name into the metadata of the newly created
endpoint reference.
Note: If you configured a virtual host for the server
on which the endpoint is created, the URI of the endpoint reference refers
to the virtual host of the HTTP server's configuration. You can override the
HTTP endpoint URL information using the administrative console
,
see Provide HTTP endpoint URL information.
The methods described previously will use the overridden value to generate
the address URI for the endpoint reference.
Results
You created an endpoint reference for use by your application.