Class WSEndpointReference
- All Implemented Interfaces:
WSDLExtension
Instances of this class are immutable and thread-safe.
- Author:
- Kohsuke Kawaguchi, Rama Pulavarthi
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents an extensibility element inside an EndpointReferenceclassParses the Metadata in an EPR and provides convenience methods to access the metadata. -
Constructor Summary
ConstructorsConstructorDescriptionWSEndpointReference(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.Creates from the spec version ofEndpointReference.WSEndpointReference(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
Modifier and TypeMethodDescriptionvoidaddReferenceParameters(HeaderList headers) Copies all the reference parameters from the givenHeaderListto this EPRvoidaddReferenceParametersToList(MessageHeaders outbound) Copies all the reference parameters in this EPR as headers to the givenMessageHeaders.Returns aSourcethat represents this EPR.static WSEndpointReferencecreate(EndpointReference epr) Converts fromEndpointReference.createDispatch(Service jaxwsService, jakarta.xml.bind.JAXBContext context, Service.Mode mode, WebServiceFeature... features) Creates aDispatchthat can be used to talk to this EPR.<T> Dispatch<T>createDispatch(Service jaxwsService, Class<T> type, Service.Mode mode, WebServiceFeature... features) Creates aDispatchthat can be used to talk to this EPR.createHeader(QName rootTagName) Returns aHeaderthat wraps thisWSEndpointReference.createWithAddress(String newAddress) Creates a newWSEndpointReferenceby replacing the address of this EPR to the new one.createWithAddress(URI newAddress) createWithAddress(URL newAddress) The value of the <wsa:address> header.getEPRExtension(QName extnQName) Returns the first extensibility element inside EPR root element with input QName.Parses the metadata inside this EPR and obtains it in a easy-to-process form.getName()Gets the QName of the EndpointReference element.<T> TgetPort(Service jaxwsService, Class<T> serviceEndpointInterface, WebServiceFeature... features) Creates a proxy that can be used to talk to this EPR.Gets the addressing version of this EPR.booleanReturns true if this has anonymous URI as theaddress.booleanisNone()Reads this EPR asXMLStreamReader.toSpec()Convert the EPR to the spec version.<T extends EndpointReference>
TConverts the EPR to the specified spec version.toString()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 Details
-
WSEndpointReference
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
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
Creates aWSEndpointReferencethat wraps a given infoset. -
WSEndpointReference
public WSEndpointReference(InputStream infoset, AddressingVersion version) throws XMLStreamException Creates aWSEndpointReferenceby parsing an infoset.- Throws:
XMLStreamException
-
WSEndpointReference
Creates aWSEndpointReferencefrom the given infoset. TheXMLStreamReadermust point to either a document or an element.- Throws:
XMLStreamException
-
WSEndpointReference
-
WSEndpointReference
-
WSEndpointReference
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 Details
-
create
Converts fromEndpointReference. This handles nullEndpointReferencecorrectly. CallWSEndpointReference(EndpointReference)directly if you know it's not null. -
createWithAddress
- See Also:
-
createWithAddress
- See Also:
-
createWithAddress
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
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:
WebServiceException- if the conversion fails, which can happen if the EPR contains invalid infoset (wrong namespace URI, etc.)
-
toSpec
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 Service jaxwsService, @NotNull Class<T> serviceEndpointInterface, 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> Dispatch<T> createDispatch(@NotNull Service jaxwsService, @NotNull Class<T> type, @NotNull Service.Mode mode, 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 Dispatch<Object> createDispatch(@NotNull Service jaxwsService, @NotNull jakarta.xml.bind.JAXBContext context, @NotNull Service.Mode mode, 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
Gets the addressing version of this EPR. -
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
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
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 SAXException Writes 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 XMLStreamException Writes 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
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
Copies all the reference parameters in this EPR as headers to the givenMessageHeaders. -
addReferenceParameters
Copies all the reference parameters from the givenHeaderListto this EPR -
toString
Dumps the EPR infoset in a human-readable string. -
getName
Gets the QName of the EndpointReference element.- Specified by:
getNamein interfaceWSDLExtension- Returns:
- must not be null.
-
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
Parses the metadata inside this EPR and obtains it in a easy-to-process form.See
WSEndpointReference.Metadataclass for what's avaliable as "metadata".
-