public final class WSEndpointReference extends Object implements WSDLExtension
Instances of this class are immutable and thread-safe.
AddressingVersion.anonymousEpr
Modifier and Type | Class and Description |
---|---|
static class |
WSEndpointReference.EPRExtension
Represents an extensibility element inside an EndpointReference
|
class |
WSEndpointReference.Metadata
Parses the Metadata in an EPR and provides convenience methods to access
the metadata.
|
Constructor and Description |
---|
WSEndpointReference(AddressingVersion version,
String address,
QName service,
QName port,
QName portType,
List<Element> metadata,
String wsdlAddress,
List<Element> referenceParameters)
Creates an EPR from individual components.
|
WSEndpointReference(AddressingVersion version,
String address,
QName service,
QName port,
QName portType,
List<Element> metadata,
String wsdlAddress,
List<Element> referenceParameters,
Collection<WSEndpointReference.EPRExtension> extns,
Map<QName,String> attributes)
Creates an EPR from individual components.
|
WSEndpointReference(AddressingVersion version,
String address,
QName service,
QName port,
QName portType,
List<Element> metadata,
String wsdlAddress,
String wsdlTargetNamepsace,
List<Element> referenceParameters,
List<Element> elements,
Map<QName,String> attributes)
Creates an EPR from individual components.
|
WSEndpointReference(EndpointReference epr)
Creates from the spec version of
EndpointReference . |
WSEndpointReference(EndpointReference epr,
AddressingVersion version)
Creates from the spec version of
EndpointReference . |
WSEndpointReference(InputStream infoset,
AddressingVersion version)
Creates a
WSEndpointReference by parsing an infoset. |
WSEndpointReference(String address,
AddressingVersion version)
Creates a
WSEndpointReference that only has an address. |
WSEndpointReference(URI address,
AddressingVersion version) |
WSEndpointReference(URL address,
AddressingVersion version) |
WSEndpointReference(com.sun.xml.stream.buffer.XMLStreamBuffer infoset,
AddressingVersion version)
Creates a
WSEndpointReference that wraps a given infoset. |
WSEndpointReference(XMLStreamReader in,
AddressingVersion version)
Creates a
WSEndpointReference from the given infoset. |
Modifier and Type | Method and Description |
---|---|
void |
addReferenceParameters(com.sun.xml.ws.api.message.HeaderList headers)
Copies all the reference parameters from the given
HeaderList
to this EPR |
void |
addReferenceParametersToList(com.sun.xml.ws.api.message.HeaderList outbound)
Deprecated.
- use addReferenceParametersToList(MessageHeaders)
|
void |
addReferenceParametersToList(com.sun.xml.ws.api.message.MessageHeaders outbound)
Copies all the reference parameters in this EPR as headers
to the given
MessageHeaders . |
Source |
asSource(String localName)
Returns a
Source that represents this EPR. |
static WSEndpointReference |
create(EndpointReference epr)
Converts from
EndpointReference . |
<T> Dispatch<T> |
createDispatch(Service jaxwsService,
Class<T> type,
Service.Mode mode,
WebServiceFeature... features)
Creates a
Dispatch that can be used to talk to this EPR. |
Dispatch<Object> |
createDispatch(Service jaxwsService,
JAXBContext context,
Service.Mode mode,
WebServiceFeature... features)
Creates a
Dispatch that can be used to talk to this EPR. |
com.sun.xml.ws.api.message.Header |
createHeader(QName rootTagName)
Returns a
Header that wraps this WSEndpointReference . |
WSEndpointReference |
createWithAddress(String newAddress)
Creates a new
WSEndpointReference by replacing the address of this EPR
to the new one. |
WSEndpointReference |
createWithAddress(URI newAddress) |
WSEndpointReference |
createWithAddress(URL newAddress) |
String |
getAddress()
The value of the <wsa:address> header.
|
WSEndpointReference.EPRExtension |
getEPRExtension(QName extnQName)
Returns the first extensibility element inside EPR root element with input QName.
|
Collection<WSEndpointReference.EPRExtension> |
getEPRExtensions() |
WSEndpointReference.Metadata |
getMetaData()
Parses the metadata inside this EPR and obtains it in a easy-to-process form.
|
QName |
getName()
Gets the QName of the EndpointReference element.
|
<T> T |
getPort(Service jaxwsService,
Class<T> serviceEndpointInterface,
WebServiceFeature... features)
Creates a proxy that can be used to talk to this EPR.
|
AddressingVersion |
getVersion()
Gets the addressing version of this EPR.
|
boolean |
isAnonymous()
Returns true if this has anonymous URI as the
address . |
boolean |
isNone()
|
XMLStreamReader |
read(String localName)
Reads this EPR as
XMLStreamReader . |
EndpointReference |
toSpec()
Convert the EPR to the spec version.
|
<T extends EndpointReference> |
toSpec(Class<T> clazz)
Converts the EPR to the specified spec version.
|
String |
toString()
Dumps the EPR infoset in a human-readable string.
|
void |
writeTo(String localName,
ContentHandler contentHandler,
ErrorHandler errorHandler,
boolean fragment)
Writes this EPR to the given
ContentHandler . |
void |
writeTo(String localName,
XMLStreamWriter w)
Writes this EPR into the given writer.
|
public WSEndpointReference(EndpointReference epr, AddressingVersion version)
EndpointReference
.
This method performs the data conversion, so it's slow. Do not use this method in a performance critical path.
public WSEndpointReference(EndpointReference epr)
EndpointReference
.
This method performs the data conversion, so it's slow. Do not use this method in a performance critical path.
public WSEndpointReference(com.sun.xml.stream.buffer.XMLStreamBuffer infoset, AddressingVersion version)
WSEndpointReference
that wraps a given infoset.public WSEndpointReference(InputStream infoset, AddressingVersion version) throws XMLStreamException
WSEndpointReference
by parsing an infoset.XMLStreamException
public WSEndpointReference(XMLStreamReader in, AddressingVersion version) throws XMLStreamException
WSEndpointReference
from the given infoset.
The XMLStreamReader
must point to either a document or an element.XMLStreamException
public WSEndpointReference(URL address, AddressingVersion version)
public WSEndpointReference(URI address, AddressingVersion version)
public WSEndpointReference(String address, AddressingVersion version)
WSEndpointReference
that only has an address.public WSEndpointReference(@NotNull AddressingVersion version, @NotNull String address, @Nullable QName service, @Nullable QName port, @Nullable QName portType, @Nullable List<Element> metadata, @Nullable String wsdlAddress, @Nullable List<Element> referenceParameters)
This version takes various information about metadata, and creates an EPR that has the necessary embedded WSDL.
public WSEndpointReference(@NotNull AddressingVersion version, @NotNull String address, @Nullable QName service, @Nullable QName port, @Nullable QName portType, @Nullable List<Element> metadata, @Nullable String wsdlAddress, @Nullable List<Element> referenceParameters, @Nullable Collection<WSEndpointReference.EPRExtension> extns, @Nullable Map<QName,String> attributes)
This version takes various information about metadata, and creates an EPR that has the necessary embedded WSDL.
public WSEndpointReference(@NotNull AddressingVersion version, @NotNull String address, @Nullable QName service, @Nullable QName port, @Nullable QName portType, @Nullable List<Element> metadata, @Nullable String wsdlAddress, @Nullable String wsdlTargetNamepsace, @Nullable List<Element> referenceParameters, @Nullable List<Element> elements, @Nullable Map<QName,String> attributes)
This version takes various information about metadata, and creates an EPR that has the necessary embedded WSDL.
@Nullable public static WSEndpointReference create(@Nullable EndpointReference epr)
EndpointReference
.
This handles null EndpointReference
correctly.
Call WSEndpointReference(EndpointReference)
directly
if you know it's not null.@NotNull public WSEndpointReference createWithAddress(@NotNull URI newAddress)
createWithAddress(String)
@NotNull public WSEndpointReference createWithAddress(@NotNull URL newAddress)
createWithAddress(String)
@NotNull public WSEndpointReference createWithAddress(@NotNull String newAddress)
WSEndpointReference
by replacing the address of this EPR
to the new one.
The following example shows how you can use this to force an HTTPS EPR, when the endpoint can serve both HTTP and HTTPS requests.
if(epr.getAddress().startsWith("http:")) epr = epr.createWithAddress("https:"+epr.getAddress().substring(5));
newAddress
- This is a complete URL to be written inside <Adress> element of the EPR,
such as "http://foo.bar/abc/def"@NotNull public EndpointReference toSpec()
EndpointReference
to be returned depends on which version
of the addressing spec this EPR conforms to.WebServiceException
- if the conversion fails, which can happen if the EPR contains
invalid infoset (wrong namespace URI, etc.)@NotNull public <T extends EndpointReference> T toSpec(Class<T> clazz)
the addressing version in use
and
the given class is different, then this may involve version conversion.@NotNull public <T> T getPort(@NotNull Service jaxwsService, @NotNull Class<T> serviceEndpointInterface, WebServiceFeature... features)
All the normal WS-Addressing processing happens automatically,
such as setting the endpoint address to the address
,
and sending the reference parameters associated with this EPR as
headers, etc.
@NotNull public <T> Dispatch<T> createDispatch(@NotNull Service jaxwsService, @NotNull Class<T> type, @NotNull Service.Mode mode, WebServiceFeature... features)
Dispatch
that can be used to talk to this EPR.
All the normal WS-Addressing processing happens automatically,
such as setting the endpoint address to the address
,
and sending the reference parameters associated with this EPR as
headers, etc.
@NotNull public Dispatch<Object> createDispatch(@NotNull Service jaxwsService, @NotNull JAXBContext context, @NotNull Service.Mode mode, WebServiceFeature... features)
Dispatch
that can be used to talk to this EPR.
All the normal WS-Addressing processing happens automatically,
such as setting the endpoint address to the address
,
and sending the reference parameters associated with this EPR as
headers, etc.
@NotNull public AddressingVersion getVersion()
@NotNull public String getAddress()
public boolean isAnonymous()
address
.public boolean isNone()
public XMLStreamReader read(@NotNull String localName) throws XMLStreamException
XMLStreamReader
.localName
- EPR uses a different root tag name depending on the context.
The returned XMLStreamReader
will use the given local name
for the root element name.XMLStreamException
public Source asSource(@NotNull String localName)
Source
that represents this EPR.localName
- EPR uses a different root tag name depending on the context.
The returned Source
will use the given local name
for the root element name.public void writeTo(@NotNull String localName, ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException
ContentHandler
.localName
- EPR uses a different root tag name depending on the context.
The returned Source
will use the given local name
for the root element name.fragment
- If true, generate a fragment SAX events without start/endDocument callbacks.
If false, generate a full XML document event.SAXException
public void writeTo(@NotNull String localName, @NotNull XMLStreamWriter w) throws XMLStreamException
localName
- EPR uses a different root tag name depending on the context.
The returned Source
will use the given local nameXMLStreamException
public com.sun.xml.ws.api.message.Header createHeader(QName rootTagName)
Header
that wraps this WSEndpointReference
.
The returned header is immutable too, and can be reused with
many Message
s.
rootTagName
- The header tag name to be used, such as <ReplyTo> or <FaultTo>.
(It's bit ugly that this method takes QName
and not just local name,
unlike other methods. If it's making the caller's life miserable, then
we can talk.)public void addReferenceParametersToList(com.sun.xml.ws.api.message.HeaderList outbound)
HeaderList
.public void addReferenceParametersToList(com.sun.xml.ws.api.message.MessageHeaders outbound)
MessageHeaders
.public void addReferenceParameters(com.sun.xml.ws.api.message.HeaderList headers)
HeaderList
to this EPRpublic String toString()
public QName getName()
getName
in interface WSDLExtension
@Nullable public WSEndpointReference.EPRExtension getEPRExtension(QName extnQName) throws XMLStreamException
XMLStreamException
@NotNull public Collection<WSEndpointReference.EPRExtension> getEPRExtensions() throws XMLStreamException
XMLStreamException
@NotNull public WSEndpointReference.Metadata getMetaData()
See WSEndpointReference.Metadata
class for what's avaliable as "metadata".
Copyright © 2015 Oracle Corporation. All rights reserved.