Class WSEndpointReference
- java.lang.Object
-
- com.sun.xml.ws.api.addressing.WSEndpointReference
-
- All Implemented Interfaces:
WSDLExtension
public final class WSEndpointReference extends Object implements WSDLExtension
Internal representation of the EPR.Instances of this class are immutable and thread-safe.
- Author:
- Kohsuke Kawaguchi, Rama Pulavarthi
- See Also:
AddressingVersion.anonymousEpr
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWSEndpointReference.EPRExtensionRepresents an extensibility element inside an EndpointReferenceclassWSEndpointReference.MetadataParses the Metadata in an EPR and provides convenience methods to access the metadata.
-
Constructor Summary
Constructors Constructor Description WSEndpointReference(XMLStreamBuffer infoset, AddressingVersion version)Creates aWSEndpointReferencethat wraps a given infoset.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(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(jakarta.xml.ws.EndpointReference epr)Creates from the spec version ofEndpointReference.WSEndpointReference(jakarta.xml.ws.EndpointReference epr, AddressingVersion version)Creates from the spec version ofEndpointReference.WSEndpointReference(InputStream infoset, AddressingVersion version)Creates aWSEndpointReferenceby parsing an infoset.WSEndpointReference(String address, AddressingVersion version)Creates aWSEndpointReferencethat only has an address.WSEndpointReference(URI address, AddressingVersion version)WSEndpointReference(URL address, AddressingVersion version)WSEndpointReference(XMLStreamReader in, AddressingVersion version)Creates aWSEndpointReferencefrom the given infoset.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddReferenceParameters(HeaderList headers)Copies all the reference parameters from the givenHeaderListto this EPRvoidaddReferenceParametersToList(HeaderList outbound)Deprecated.- use addReferenceParametersToList(MessageHeaders)voidaddReferenceParametersToList(MessageHeaders outbound)Copies all the reference parameters in this EPR as headers to the givenMessageHeaders.SourceasSource(String localName)Returns aSourcethat represents this EPR.static WSEndpointReferencecreate(jakarta.xml.ws.EndpointReference epr)Converts fromEndpointReference.jakarta.xml.ws.Dispatch<Object>createDispatch(jakarta.xml.ws.Service jaxwsService, jakarta.xml.bind.JAXBContext context, jakarta.xml.ws.Service.Mode mode, jakarta.xml.ws.WebServiceFeature... features)Creates aDispatchthat can be used to talk to this EPR.<T> jakarta.xml.ws.Dispatch<T>createDispatch(jakarta.xml.ws.Service jaxwsService, Class<T> type, jakarta.xml.ws.Service.Mode mode, jakarta.xml.ws.WebServiceFeature... features)Creates aDispatchthat can be used to talk to this EPR.HeadercreateHeader(QName rootTagName)Returns aHeaderthat wraps thisWSEndpointReference.WSEndpointReferencecreateWithAddress(String newAddress)Creates a newWSEndpointReferenceby replacing the address of this EPR to the new one.WSEndpointReferencecreateWithAddress(URI newAddress)WSEndpointReferencecreateWithAddress(URL newAddress)StringgetAddress()The value of the <wsa:address> header.WSEndpointReference.EPRExtensiongetEPRExtension(QName extnQName)Returns the first extensibility element inside EPR root element with input QName.Collection<WSEndpointReference.EPRExtension>getEPRExtensions()WSEndpointReference.MetadatagetMetaData()Parses the metadata inside this EPR and obtains it in a easy-to-process form.QNamegetName()Gets the QName of the EndpointReference element.<T> TgetPort(jakarta.xml.ws.Service jaxwsService, Class<T> serviceEndpointInterface, jakarta.xml.ws.WebServiceFeature... features)Creates a proxy that can be used to talk to this EPR.AddressingVersiongetVersion()Gets the addressing version of this EPR.booleanisAnonymous()Returns true if this has anonymous URI as theaddress.booleanisNone()XMLStreamReaderread(String localName)Reads this EPR asXMLStreamReader.jakarta.xml.ws.EndpointReferencetoSpec()Convert the EPR to the spec version.<T extends jakarta.xml.ws.EndpointReference>
TtoSpec(Class<T> clazz)Converts the EPR to the specified spec version.StringtoString()Dumps the EPR infoset in a human-readable string.voidwriteTo(String localName, XMLStreamWriter w)Writes this EPR into the given writer.voidwriteTo(String localName, ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment)Writes this EPR to the givenContentHandler.
-
-
-
Constructor Detail
-
WSEndpointReference
public WSEndpointReference(jakarta.xml.ws.EndpointReference epr, AddressingVersion version)Creates from the spec version ofEndpointReference.This method performs the data conversion, so it's slow. Do not use this method in a performance critical path.
-
WSEndpointReference
public WSEndpointReference(jakarta.xml.ws.EndpointReference epr)
Creates from the spec version ofEndpointReference.This method performs the data conversion, so it's slow. Do not use this method in a performance critical path.
-
WSEndpointReference
public WSEndpointReference(XMLStreamBuffer infoset, AddressingVersion version)
Creates aWSEndpointReferencethat wraps a given infoset.
-
WSEndpointReference
public WSEndpointReference(InputStream infoset, AddressingVersion version) throws XMLStreamException
Creates aWSEndpointReferenceby parsing an infoset.- Throws:
XMLStreamException
-
WSEndpointReference
public WSEndpointReference(XMLStreamReader in, AddressingVersion version) throws XMLStreamException
Creates aWSEndpointReferencefrom the given infoset. TheXMLStreamReadermust point to either a document or an element.- Throws:
XMLStreamException
-
WSEndpointReference
public WSEndpointReference(URL address, AddressingVersion version)
-
WSEndpointReference
public WSEndpointReference(URI address, AddressingVersion version)
-
WSEndpointReference
public WSEndpointReference(String address, AddressingVersion version)
Creates aWSEndpointReferencethat only has an address.
-
WSEndpointReference
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)Creates an EPR from individual components.This version takes various information about metadata, and creates an EPR that has the necessary embedded WSDL.
-
WSEndpointReference
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)Creates an EPR from individual components.This version takes various information about metadata, and creates an EPR that has the necessary embedded WSDL.
-
WSEndpointReference
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)Creates an EPR from individual components.This version takes various information about metadata, and creates an EPR that has the necessary embedded WSDL.
- Since:
- JAX-WS 2.2
-
-
Method Detail
-
create
@Nullable public static WSEndpointReference create(@Nullable jakarta.xml.ws.EndpointReference epr)
Converts fromEndpointReference. This handles nullEndpointReferencecorrectly. CallWSEndpointReference(EndpointReference)directly if you know it's not null.
-
createWithAddress
@NotNull public WSEndpointReference createWithAddress(@NotNull URI newAddress)
- See Also:
createWithAddress(String)
-
createWithAddress
@NotNull public WSEndpointReference createWithAddress(@NotNull URL newAddress)
- See Also:
createWithAddress(String)
-
createWithAddress
@NotNull public WSEndpointReference createWithAddress(@NotNull String newAddress)
Creates a newWSEndpointReferenceby 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));- Parameters:
newAddress- This is a complete URL to be written inside <Address> element of the EPR, such as "http://foo.bar/abc/def"
-
toSpec
@NotNull public jakarta.xml.ws.EndpointReference toSpec()
Convert the EPR to the spec version. The actual type ofEndpointReferenceto be returned depends on which version of the addressing spec this EPR conforms to.- Throws:
jakarta.xml.ws.WebServiceException- if the conversion fails, which can happen if the EPR contains invalid infoset (wrong namespace URI, etc.)
-
toSpec
@NotNull public <T extends jakarta.xml.ws.EndpointReference> T toSpec(Class<T> clazz)
Converts the EPR to the specified spec version. If thethe addressing version in useand the given class is different, then this may involve version conversion.
-
getPort
@NotNull public <T> T getPort(@NotNull jakarta.xml.ws.Service jaxwsService, @NotNull Class<T> serviceEndpointInterface, jakarta.xml.ws.WebServiceFeature... features)Creates a proxy 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.
-
createDispatch
@NotNull public <T> jakarta.xml.ws.Dispatch<T> createDispatch(@NotNull jakarta.xml.ws.Service jaxwsService, @NotNull Class<T> type, @NotNull jakarta.xml.ws.Service.Mode mode, jakarta.xml.ws.WebServiceFeature... features)Creates aDispatchthat 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.
-
createDispatch
@NotNull public jakarta.xml.ws.Dispatch<Object> createDispatch(@NotNull jakarta.xml.ws.Service jaxwsService, @NotNull jakarta.xml.bind.JAXBContext context, @NotNull jakarta.xml.ws.Service.Mode mode, jakarta.xml.ws.WebServiceFeature... features)
Creates aDispatchthat 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.
-
getVersion
@NotNull public AddressingVersion getVersion()
Gets the addressing version of this EPR.
-
getAddress
@NotNull public String getAddress()
The value of the <wsa:address> header.
-
isAnonymous
public boolean isAnonymous()
Returns true if this has anonymous URI as theaddress.
-
isNone
public boolean isNone()
-
read
public XMLStreamReader read(@NotNull String localName) throws XMLStreamException
Reads this EPR asXMLStreamReader.- Parameters:
localName- EPR uses a different root tag name depending on the context. The returnedXMLStreamReaderwill use the given local name for the root element name.- Throws:
XMLStreamException
-
asSource
public Source asSource(@NotNull String localName)
Returns aSourcethat represents this EPR.- Parameters:
localName- EPR uses a different root tag name depending on the context. The returnedSourcewill use the given local name for the root element name.
-
writeTo
public void writeTo(@NotNull String localName, ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXExceptionWrites this EPR to the givenContentHandler.- Parameters:
localName- EPR uses a different root tag name depending on the context. The returnedSourcewill 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.- Throws:
SAXException
-
writeTo
public void writeTo(@NotNull String localName, @NotNull XMLStreamWriter w) throws XMLStreamExceptionWrites this EPR into the given writer.- Parameters:
localName- EPR uses a different root tag name depending on the context. The returnedSourcewill use the given local name- Throws:
XMLStreamException
-
createHeader
public Header createHeader(QName rootTagName)
Returns aHeaderthat wraps thisWSEndpointReference.The returned header is immutable too, and can be reused with many
Messages.- Parameters:
rootTagName- The header tag name to be used, such as <ReplyTo> or <FaultTo>. (It's bit ugly that this method takesQNameand not just local name, unlike other methods. If it's making the caller's life miserable, then we can talk.)
-
addReferenceParametersToList
public void addReferenceParametersToList(HeaderList outbound)
Deprecated.- use addReferenceParametersToList(MessageHeaders)Copies all the reference parameters in this EPR as headers to the givenHeaderList.
-
addReferenceParametersToList
public void addReferenceParametersToList(MessageHeaders outbound)
Copies all the reference parameters in this EPR as headers to the givenMessageHeaders.
-
addReferenceParameters
public void addReferenceParameters(HeaderList headers)
Copies all the reference parameters from the givenHeaderListto this EPR
-
toString
public String toString()
Dumps the EPR infoset in a human-readable string.
-
getName
public QName getName()
Gets the QName of the EndpointReference element.- Specified by:
getNamein interfaceWSDLExtension- Returns:
-
getEPRExtension
@Nullable public WSEndpointReference.EPRExtension getEPRExtension(QName extnQName) throws XMLStreamException
Returns the first extensibility element inside EPR root element with input QName.- Throws:
XMLStreamException
-
getEPRExtensions
@NotNull public Collection<WSEndpointReference.EPRExtension> getEPRExtensions() throws XMLStreamException
- Throws:
XMLStreamException
-
getMetaData
@NotNull public WSEndpointReference.Metadata getMetaData()
Parses the metadata inside this EPR and obtains it in a easy-to-process form.See
WSEndpointReference.Metadataclass for what's avaliable as "metadata".
-
-