Skip to main content

The @WebService annotation

The @WebService annotation is defined by the javax.jws.WebService interface and it is placed on an interface or a class that is intended to be used as a service. @WebService has the following properties:

Property

Description

name

Specifies the name of the service interface. This property is mapped to the name attribute of the wsdl:portType element that defines the service's interface in a WSDL contract. The default is to append PortType to the name of the implementation class.

targetNamespace

Specifies the target namespace under which the service is defined. If this property is not specified, the target namespace is derived from the package name.

serviceName

Specifies the name of the published service. This property is mapped to the name attribute of the wsdl:service element that defines the published service. The default is to use the name of the service's implementation class. Note: Not allowed on the SEI

wsdlLocation

Specifies the URI at which the service's WSDL contract is stored. The default is the URI at which the service is deployed.

endpointInterface

Specifies the full name of the SEI that the implementation class implements. This property is only used when the attribute is used on a service implementation class. Note: Not allowed on the SEI

portName

Specifies the name of the endpoint at which the service is published. This property is mapped to the name attribute of the wsdl:port element that specifies the endpoint details for a published service. The default is the append Port to the name of the service's implementation class. Note: Not allowed on the SEI

Information noteNote: You do not need to provide values for any of the @WebService annotation's properties. However, it is recommended that you provide as much information as you can.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!