The jaxws:endpoint
element is the default element for configuring JAX-WS service
providers. Its attributes and children specify all of the information needed to instantiate a service provider. Many of the
attributes map to information in the service's contract. The children are used to configure interceptors and other advanced
features.
For the runtime to apply the configuration to the proper service provider, it must be able to identify it.
The basic means for identifying a service provider is to specify the class that implements the endpoint. This is
done using the jaxws:endpoint
element's implementor
attribute.
For instances where different endpoint's share a common implementation, it is possible to provide different configuration for each endpoint. There are two approaches for distinguishing a specific endpoint in configuration:
a combination of the serviceName
attribute and the endpointName
attribute
The serviceName
attribute specifies the wsdl:service
element
defining the service's endpoint. The endpointName
attribute specifies the specific
wsdl:port
element defining the service's endpoint. Both attributes are specified as QNames using the
format
.
ns
:name
ns
is the namespace of the element and name
is the value of the element's
name
attribute.
![]() | Tip |
---|---|
If the |
the name
attribute
The name
attribute specifies the QName of the specific
wsdl:port
element defining the service's endpoint. The QName is provided in the format
{
.
ns
}localPart
ns
is the namespace of the wsdl:port
element and
localPart
is the value of the wsdl:port
element's
name
attribute.
The attributes of the jaxws:endpoint
element configure the basic properties of the endpoint. These
properties include the address of the endpoint, the class that implements the endpoint, and the bus
that hosts the endpoint.
Table 3.1 describes the attribute of the jaxws:endpoint
element.
Table 3.1. Attributes for Configuring a JAX-WS Service Provider Using the jaxws:endpoint
Element
Attribute | Description |
---|---|
id
| Specifies a unique identifier that other configuration elements can use to refer to the endpoint. |
implementor
| Specifies the class implementing the service. You can specify the implementation class using either the class name or an ID reference to a Spring bean configuring the implementation class. This class must be on the classpath. |
implementorClass
| Specifies the class implementing the service. This attribute is useful when the value provided to the
implementor attribute is a reference to a bean that is wrapped using Spring AOP. |
address
| Specifies the address of an HTTP endpoint. This value overrides the value specified in the services contract. |
wsdlLocation
| Specifies the location of the endpoint's WSDL contract. The WSDL contract's location is relative to the folder from which the service is deployed. |
endpointName
| Specifies the value of the service's wsdl:port element's name
attribute. It is specified as a QName using the format
where ns is the namespace of the wsdl:port element. |
serviceName
| Specifies the value of the service's wsdl:service element's name attribute.
It is specified as a QName using the format
where ns is the namespace of the wsdl:service element. |
publish
| Specifies if the service should be automatically published. If this is set to false , the developer must explicitly
publish the endpoint as described in Publishing a Service in |
bus
| Specifies the ID of the Spring bean configuring the bus used to manage the service endpoint. This is useful when configuring several endpoints to use a common set of features. |
bindingUri
| Specifies the ID of the message binding the service uses. A list of valid binding IDs is provided in Appendix A. |
name
| Specifies the stringified QName of the service's wsdl:port element. It is specified as a QName using
the format { .
ns is the namespace of the wsdl:port element and
localPart is the value of the wsdl:port element's
name attribute. |
abstract
| Specifies if the bean is an abstract bean. Abstract beans act as parents for concrete bean definitions and are not instantiated. The
default is false . Setting this to true instructs the bean factory not to instantiate
the bean. |
depends-on
| Specifies a list of beans that the endpoint depends on being instantiated before it can be instantiated. |
createdFromAPI
|
Specifies that the user created that bean using FUSE Services Framework APIs, such as The default is Setting this to
|
In addition to the attributes listed in Table 3.1, you might need to use multiple
xmlns:
attributes to declare the namespaces used
by the shortName
endpointName
and
serviceName
attributes.
Example 3.1 shows the configuration for a JAX-WS endpoint that specifies the address where the endpoint is published. The example assumes that you want to use the defaults for all other values or that the implementation has specified values in the annotations.
Example 3.1. Simple JAX-WS Endpoint Configuration
<beans ... xmlns:jaxws="http://cxf.apache.org/jaxws" ... schemaLocation="... http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd ..."> <jaxws:endpoint id="example" implementor="org.apache.cxf.example.DemoImpl" address="http://localhost:8080/demo" /> </beans>
Example 3.2 shows the configuration for a JAX-WS endpoint whose contract contains two service definitions. In this case, you
must specify which service definition to instantiate using the serviceName
attribute.
Example 3.2. JAX-WS Endpoint Configuration with a Service Name
<beans ...
xmlns:jaxws="http://cxf.apache.org/jaxws"
...
schemaLocation="...
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
...">
<jaxws:endpoint id="example2"
implementor="org.apache.cxf.example.DemoImpl"
serviceName="samp:demoService2"
xmlns:samp="http://org.apache.cxf/wsdl/example" />
</beans>
The xmlns:samp
attribute specifies the namespace in which the WSDL
service
element is defined.