Class W3CEndpointReferenceBuilder
- java.lang.Object
-
- jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder
-
public final class W3CEndpointReferenceBuilder extends Object
This class is used to buildW3CEndpointReference
instances. The intended use of this clsss is for an application component, for example a factory component, to create anW3CEndpointReference
for a web service endpoint published by the same Jakarta EE application. It can also be used to createW3CEndpointReferences
for an Java SE based endpoint by providing theaddress
property.When creating a
W3CEndpointReference
for an endpoint that is not published by the same Jakarta EE application, theaddress
property MUST be specified.When creating a
W3CEndpointReference
for an endpoint published by the same Jakarta EE application, theaddress
property MAY benull
but then theserviceName
andendpointName
MUST specify an endpoint published by the same Jakarta EE application.When the
wsdlDocumentLocation
is specified it MUST refer to a valid WSDL document and theserviceName
andendpointName
(if specified) MUST match a service and port in the WSDL document.- Since:
- 1.6, JAX-WS 2.1
-
-
Constructor Summary
Constructors Constructor Description W3CEndpointReferenceBuilder()
Creates a newW3CEndpointReferenceBuilder
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description W3CEndpointReferenceBuilder
address(String address)
Sets theaddress
to theW3CEndpointReference
instance'swsa:Address
.W3CEndpointReferenceBuilder
attribute(QName name, String value)
Adds an extension attribute to theW3CEndpointReference
instance'swsa:EndpointReference
element.W3CEndpointReference
build()
Builds aW3CEndpointReference
from the accumulated properties set on thisW3CEndpointReferenceBuilder
instance.W3CEndpointReferenceBuilder
element(Element element)
Adds an extension element to theW3CEndpointReference
instance'swsa:EndpointReference
element.W3CEndpointReferenceBuilder
endpointName(QName endpointName)
Sets theendpointName
aswsam:ServiceName/@EndpointName
in thewsa:Metadata
element.W3CEndpointReferenceBuilder
interfaceName(QName interfaceName)
Sets theinterfaceName
as thewsam:InterfaceName
element in thewsa:Metadata
element.W3CEndpointReferenceBuilder
metadata(Element metadataElement)
Adds themetadataElement
to theW3CEndpointReference
instance'swsa:Metadata
element.W3CEndpointReferenceBuilder
referenceParameter(Element referenceParameter)
Adds thereferenceParameter
to theW3CEndpointReference
instancewsa:ReferenceParameters
element.W3CEndpointReferenceBuilder
serviceName(QName serviceName)
Sets theserviceName
as thewsam:ServiceName
element in thewsa:Metadata
element.W3CEndpointReferenceBuilder
wsdlDocumentLocation(String wsdlDocumentLocation)
Sets thewsdlDocumentLocation
that will be referenced aswsa:Metadata/@wsdli:wsdlLocation
.
-
-
-
Method Detail
-
address
public W3CEndpointReferenceBuilder address(String address)
Sets theaddress
to theW3CEndpointReference
instance'swsa:Address
.The
address
MUST be set to a non-null
value when building aW3CEndpointReference
for a web service endpoint that is not published by the same Jakarta EE application or when running on Java SE.- Parameters:
address
- The address of the endpoint to be targeted by the returnedW3CEndpointReference
.- Returns:
- A
W3CEndpointReferenceBuilder
instance with theaddress
set to thewsa:Address
.
-
interfaceName
public W3CEndpointReferenceBuilder interfaceName(QName interfaceName)
Sets theinterfaceName
as thewsam:InterfaceName
element in thewsa:Metadata
element. See 2.1 Referencing WSDL Metadata from an EPR for more details.- Parameters:
interfaceName
- The port type name of the endpoint to be targeted by the returnedW3CEndpointReference
.- Returns:
- A
W3CEndpointReferenceBuilder
instance with theinterfaceName
aswsam:InterfaceName
element added to thewsa:Metadata
element - Since:
- 1.7
-
serviceName
public W3CEndpointReferenceBuilder serviceName(QName serviceName)
Sets theserviceName
as thewsam:ServiceName
element in thewsa:Metadata
element. See 2.1 Referencing WSDL Metadata from an EPR for more details.- Parameters:
serviceName
- The service name of the endpoint to be targeted by the returnedW3CEndpointReference
. This property may also be used with theendpointName
(portName) property to lookup theaddress
of a web service endpoint that is published by the same Jakarta EE application.- Returns:
- A
W3CEndpointReferenceBuilder
instance with theserviceName
aswsam:ServiceName
element added to thewsa:Metadata
element
-
endpointName
public W3CEndpointReferenceBuilder endpointName(QName endpointName)
Sets theendpointName
aswsam:ServiceName/@EndpointName
in thewsa:Metadata
element. This method can only be called after theserviceName(QName)
method has been called.See 2.1 Referencing WSDL Metadata from an EPR for more details.
- Parameters:
endpointName
- The name of the endpoint to be targeted by the returnedW3CEndpointReference
. TheendpointName
(portName) property may also be used with theserviceName
property to lookup theaddress
of a web service endpoint published by the same Jakarta EE application.- Returns:
- A
W3CEndpointReferenceBuilder
instance with theendpointName
aswsam:ServiceName/@EndpointName
in thewsa:Metadata
element. - Throws:
IllegalStateException
- if theserviceName
has not been setIllegalArgumentException
- if theendpointName
's Namespace URI doesn't matchserviceName
's Namespace URI
-
wsdlDocumentLocation
public W3CEndpointReferenceBuilder wsdlDocumentLocation(String wsdlDocumentLocation)
Sets thewsdlDocumentLocation
that will be referenced aswsa:Metadata/@wsdli:wsdlLocation
. The namespace name for the wsdli:wsdlLocation's value can be taken from the WSDL itself.See 2.1 Referencing WSDL Metadata from an EPR for more details.
- Parameters:
wsdlDocumentLocation
- The location of the WSDL document to be referenced in thewsa:Metadata
of theW3CEndpointReference
.- Returns:
- A
W3CEndpointReferenceBuilder
instance with thewsdlDocumentLocation
that is to be referenced.
-
referenceParameter
public W3CEndpointReferenceBuilder referenceParameter(Element referenceParameter)
Adds thereferenceParameter
to theW3CEndpointReference
instancewsa:ReferenceParameters
element.- Parameters:
referenceParameter
- The element to be added to thewsa:ReferenceParameters
element.- Returns:
- A
W3CEndpointReferenceBuilder
instance with thereferenceParameter
added to thewsa:ReferenceParameters
element. - Throws:
IllegalArgumentException
- ifreferenceParameter
isnull
.
-
metadata
public W3CEndpointReferenceBuilder metadata(Element metadataElement)
Adds themetadataElement
to theW3CEndpointReference
instance'swsa:Metadata
element.- Parameters:
metadataElement
- The element to be added to thewsa:Metadata
element.- Returns:
- A
W3CEndpointReferenceBuilder
instance with themetadataElement
added to thewsa:Metadata
element. - Throws:
IllegalArgumentException
- ifmetadataElement
isnull
.
-
element
public W3CEndpointReferenceBuilder element(Element element)
Adds an extension element to theW3CEndpointReference
instance'swsa:EndpointReference
element.- Parameters:
element
- The extension element to be added to theW3CEndpointReference
- Returns:
- A
W3CEndpointReferenceBuilder
instance with the extensionelement
added to theW3CEndpointReference
instance. - Throws:
IllegalArgumentException
- ifelement
isnull
.- Since:
- 1.7, JAX-WS 2.2
-
attribute
public W3CEndpointReferenceBuilder attribute(QName name, String value)
Adds an extension attribute to theW3CEndpointReference
instance'swsa:EndpointReference
element.- Parameters:
name
- The name of the extension attribute to be added to theW3CEndpointReference
value
- extension attribute value- Returns:
- A
W3CEndpointReferenceBuilder
instance with the extension attribute added to theW3CEndpointReference
instance. - Throws:
IllegalArgumentException
- ifname
orvalue
isnull
.- Since:
- 1.7, JAX-WS 2.2
-
build
public W3CEndpointReference build()
Builds aW3CEndpointReference
from the accumulated properties set on thisW3CEndpointReferenceBuilder
instance.This method can be used to create a
W3CEndpointReference
for any endpoint by specifying theaddress
property along with any other desired properties. This method can also be used to create aW3CEndpointReference
for an endpoint that is published by the same Jakarta EE application. This method can automatically determine theaddress
of an endpoint published by the same Jakarta EE application that is identified by theserviceName
andendpointName
properties. If theaddress
isnull
and theserviceName
andendpointName
do not identify an endpoint published by the same Jakarta EE application, ajava.lang.IllegalStateException
MUST be thrown.- Returns:
W3CEndpointReference
from the accumulated properties set on thisW3CEndpointReferenceBuilder
instance. This method never returnsnull
.- Throws:
IllegalStateException
-- If the
address
,serviceName
andendpointName
are allnull
. - If the
serviceName
service isnull
and theendpointName
is NOTnull
. - If the
address
property isnull
and theserviceName
andendpointName
do not specify a valid endpoint published by the same Jakarta EE application. - If the
serviceName
is NOTnull
and is not present in the specified WSDL. - If the
endpointName
port is notnull
and it is not present inserviceName
service in the WSDL. - If the
wsdlDocumentLocation
is NOTnull
and does not represent a valid WSDL.
- If the
WebServiceException
- If an error occurs while creating theW3CEndpointReference
.
-
-