The jaxws:server
element is an element for configuring JAX-WS service providers. It injects the configuration information
into the org.apache.cxf.jaxws.support.JaxWsServerFactoryBean
. This is a FUSE Services Framework specific object. If you are using a pure
Spring approach to building your services, you will not be forced to use FUSE Services Framework specific APIs to interact with the service.
The attributes and children of the jaxws:server
element specify all of the information needed to instantiate a service
provider. The attributes specify the information that is required to instantiate an endpoint. The children are used to configure interceptors and other
advanced features.
In order 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:server
element's
serviceBean
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:server
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.2 describes the attribute of the jaxws:server
element.
Table 3.2. Attributes for Configuring a JAX-WS Service Provider Using the jaxws:server
Element
Attribute | Description |
---|---|
id
| Specifies a unique identifier that other configuration elements can use to refer to the endpoint. |
serviceBean
| 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. |
serviceClass
| 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 will override 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. |
start
| 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. |
bindingId
| 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 { , where
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 the endpoint 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.2, you might need to use multiple
xmlns:
attributes to declare the namespaces used by the
shortName
endpointName
and
serviceName
attributes.
Example 3.3 shows the configuration for a JAX-WS endpoint that specifies the address where the endpoint is published.
Example 3.3. Simple JAX-WS Server Configuration
<beans ... xmlns:jaxws="http://cxf.apache.org/jaxws" ... schemaLocation="... http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd ..."> <jaxws:server id="exampleServer" serviceBean="org.apache.cxf.example.DemoImpl" address="http://localhost:8080/demo" /> </beans>