The javax.xml.ws.Service
class represents the wsdl:service
element that contains the definition of all of the endpoints that expose a service. As such it provides methods that allow you to get endpoints, defined by wsdl:port
elements, that are proxies for making remote invocations on a service.
Note | |
---|---|
The |
The Service
class has two static create()
methods that can be used to create a new Service
object. As shown in Example 2.1, “Service
create()
Methods”, both of the create()
methods take the QName of the wsdl:service
element the Service
object will represent and one takes a URI specifying the location of the WSDL contract.
Tip | |
---|---|
All services publish there WSDL contracts. For SOAP/HTTP services the URI is usually the URI at which the service is published appended with |
Example 2.1. Service
create()
Methods
public static Service create(URL wsdlLocation,
QName serviceName)
throws WebServiceException;
public static Service create(QName serviceName)
throws WebServiceException;
The value of the serviceName
parameter is a QName. The value of its namespace part is the target namespace of the service. The service's target namespace is specified in the targetNamespace property of the @WebService
annotation. The value of the QName's local part is the value of wsdl:service
element's name
attribute. You can determine this value in a number of ways:
It is specified in the serviceName property of the @WebService
annotation.
You append Service
to the value of the name property of the @WebService
annotation.
You append Service
to the name of the SEI.
Example 2.2, “Creating a Service
Object” shows code for creating a Service
object for the SEI shown in Example 1.7, “Fully Annotated SEI”.
The code in Example 2.2, “Creating a Service
Object” does the following: