com.sun.xml.ws.api.addressing.WSEndpointReference Maven / Gradle / Ivy
Show all versions of jaxws-rt Show documentation
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.xml.ws.api.addressing;
import com.sun.istack.NotNull;
import com.sun.istack.Nullable;
import com.sun.xml.stream.buffer.MutableXMLStreamBuffer;
import com.sun.xml.stream.buffer.XMLStreamBuffer;
import com.sun.xml.stream.buffer.XMLStreamBufferResult;
import com.sun.xml.stream.buffer.XMLStreamBufferSource;
import com.sun.xml.stream.buffer.sax.SAXBufferProcessor;
import com.sun.xml.stream.buffer.stax.StreamReaderBufferProcessor;
import com.sun.xml.stream.buffer.stax.StreamWriterBufferCreator;
import com.sun.xml.ws.addressing.EndpointReferenceUtil;
import com.sun.xml.ws.addressing.W3CAddressingMetadataConstants;
import com.sun.xml.ws.addressing.WSEPRExtension;
import com.sun.xml.ws.addressing.model.InvalidAddressingHeaderException;
import com.sun.xml.ws.addressing.v200408.MemberSubmissionAddressingConstants;
import com.sun.xml.ws.api.message.Header;
import com.sun.xml.ws.api.message.HeaderList;
import com.sun.xml.ws.api.message.Message;
import com.sun.xml.ws.api.message.MessageHeaders;
import com.sun.xml.ws.api.streaming.XMLStreamReaderFactory;
import com.sun.xml.ws.api.model.wsdl.WSDLExtension;
import com.sun.xml.ws.resources.AddressingMessages;
import com.sun.xml.ws.resources.ClientMessages;
import com.sun.xml.ws.spi.ProviderImpl;
import com.sun.xml.ws.streaming.XMLStreamReaderUtil;
import com.sun.xml.ws.util.DOMUtil;
import com.sun.xml.ws.util.xml.XMLStreamWriterFilter;
import com.sun.xml.ws.util.xml.XmlUtil;
import com.sun.xml.ws.util.xml.XMLStreamReaderToXMLStreamWriter;
import com.sun.xml.ws.wsdl.parser.WSDLConstants;
import org.w3c.dom.Element;
import org.xml.sax.*;
import org.xml.sax.helpers.XMLFilterImpl;
import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.URI;
import java.net.URL;
import java.util.*;
/**
* Internal representation of the EPR.
*
*
* Instances of this class are immutable and thread-safe.
*
* @author Kohsuke Kawaguchi
* @author Rama Pulavarthi
*
* @see AddressingVersion#anonymousEpr
*/
public final class WSEndpointReference implements WSDLExtension {
private final XMLStreamBuffer infoset;
/**
* Version of the addressing spec.
*/
private final AddressingVersion version;
/**
* Marked Reference parameters inside this EPR.
*
* Parsed when the object is created. can be empty but never null.
* @see #parse()
*/
private @NotNull Header[] referenceParameters;
private @NotNull String address;
private @NotNull QName rootElement;
/**
* Creates from the spec version of {@link 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, AddressingVersion version) {
try {
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
epr.writeTo(new XMLStreamBufferResult(xsb));
this.infoset = xsb;
this.version = version;
this.rootElement = new QName("EndpointReference", version.nsUri);
parse();
} catch (XMLStreamException e) {
throw new WebServiceException(ClientMessages.FAILED_TO_PARSE_EPR(epr),e);
}
}
/**
* Creates from the spec version of {@link 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) {
this(epr,AddressingVersion.fromSpecClass(epr.getClass()));
}
/**
* Creates a {@link WSEndpointReference} that wraps a given infoset.
*/
public WSEndpointReference(XMLStreamBuffer infoset, AddressingVersion version) {
try {
this.infoset = infoset;
this.version = version;
this.rootElement = new QName("EndpointReference", version.nsUri);
parse();
} catch (XMLStreamException e) {
// this can never happen because XMLStreamBuffer never has underlying I/O error.
throw new AssertionError(e);
}
}
/**
* Creates a {@link WSEndpointReference} by parsing an infoset.
*/
public WSEndpointReference(InputStream infoset, AddressingVersion version) throws XMLStreamException {
this(XMLStreamReaderFactory.create(null,infoset,false),version);
}
/**
* Creates a {@link WSEndpointReference} from the given infoset.
* The {@link XMLStreamReader} must point to either a document or an element.
*/
public WSEndpointReference(XMLStreamReader in, AddressingVersion version) throws XMLStreamException {
this(XMLStreamBuffer.createNewBufferFromXMLStreamReader(in), version);
}
/**
* @see #WSEndpointReference(String, AddressingVersion)
*/
public WSEndpointReference(URL address, AddressingVersion version) {
this(address.toExternalForm(), version);
}
/**
* @see #WSEndpointReference(String, AddressingVersion)
*/
public WSEndpointReference(URI address, AddressingVersion version) {
this(address.toString(), version);
}
/**
* Creates a {@link WSEndpointReference} that only has an address.
*/
public WSEndpointReference(String address, AddressingVersion version) {
this.infoset = createBufferFromAddress(address,version);
this.version = version;
this.address = address;
this.rootElement = new QName("EndpointReference", version.nsUri);
this.referenceParameters = EMPTY_ARRAY;
}
private static XMLStreamBuffer createBufferFromAddress(String address, AddressingVersion version) {
try {
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
StreamWriterBufferCreator w = new StreamWriterBufferCreator(xsb);
w.writeStartDocument();
w.writeStartElement(version.getPrefix(),
"EndpointReference", version.nsUri);
w.writeNamespace(version.getPrefix(), version.nsUri);
w.writeStartElement(version.getPrefix(),version.eprType.address, version.nsUri);
w.writeCharacters(address);
w.writeEndElement();
w.writeEndElement();
w.writeEndDocument();
w.close();
return xsb;
} catch (XMLStreamException e) {
// can never happen because we are writing to XSB
throw new AssertionError(e);
}
}
/**
* Creates an EPR from individual components.
*
*
* 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 metadata,
@Nullable String wsdlAddress,
@Nullable List referenceParameters) {
this(version, address, service, port, portType, metadata, wsdlAddress, null, referenceParameters, null, null);
}
/**
* Creates an EPR from individual components.
*
*
* 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 metadata,
@Nullable String wsdlAddress,
@Nullable List referenceParameters,
@Nullable Collection extns,@Nullable Map attributes) {
this(createBufferFromData(version, address, referenceParameters, service, port, portType, metadata, wsdlAddress, null, extns, attributes),
version );
}
/**
* 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
*/
public WSEndpointReference(@NotNull AddressingVersion version,
@NotNull String address,
@Nullable QName service,
@Nullable QName port,
@Nullable QName portType,
@Nullable List metadata,
@Nullable String wsdlAddress,
@Nullable String wsdlTargetNamepsace,
@Nullable List referenceParameters,
@Nullable List elements, @Nullable Map attributes) {
this(
createBufferFromData(version, address, referenceParameters, service, port, portType, metadata, wsdlAddress,wsdlTargetNamepsace, elements, attributes),
version );
}
private static XMLStreamBuffer createBufferFromData(AddressingVersion version, String address, List referenceParameters, QName service, QName port, QName portType,
List metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable List elements, @Nullable Map attributes) {
StreamWriterBufferCreator writer = new StreamWriterBufferCreator();
try {
writer.writeStartDocument();
writer.writeStartElement(version.getPrefix(),"EndpointReference", version.nsUri);
writer.writeNamespace(version.getPrefix(),version.nsUri);
writePartialEPRInfoset(writer, version, address, referenceParameters, service, port, portType,
metadata,wsdlAddress, wsdlTargetNamespace, attributes);
//write extensibility elements in the EPR element
if (elements != null) {
for (Element e : elements) {
DOMUtil.serializeNode(e, writer);
}
}
writer.writeEndElement();
writer.writeEndDocument();
writer.flush();
return writer.getXMLStreamBuffer();
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
}
private static XMLStreamBuffer createBufferFromData(AddressingVersion version, String address, List referenceParameters, QName service, QName port, QName portType,
List metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Collection extns, @Nullable Map attributes) {
StreamWriterBufferCreator writer = new StreamWriterBufferCreator();
try {
writer.writeStartDocument();
writer.writeStartElement(version.getPrefix(),"EndpointReference", version.nsUri);
writer.writeNamespace(version.getPrefix(),version.nsUri);
writePartialEPRInfoset(writer, version, address, referenceParameters, service, port, portType,
metadata,wsdlAddress, wsdlTargetNamespace, attributes);
//write extensibility elements in the EPR element
if (extns != null) {
for (EPRExtension e : extns) {
XMLStreamReaderToXMLStreamWriter c = new XMLStreamReaderToXMLStreamWriter();
XMLStreamReader r = e.readAsXMLStreamReader();
c.bridge(r, writer);
XMLStreamReaderFactory.recycle(r);
}
}
writer.writeEndElement();
writer.writeEndDocument();
writer.flush();
return writer.getXMLStreamBuffer();
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
}
private static void writePartialEPRInfoset(StreamWriterBufferCreator writer, AddressingVersion version, String address, List referenceParameters, QName service, QName port, QName portType,
List metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Map attributes) throws XMLStreamException {
//add extensibile attributes on the EPR element
if (attributes != null) {
for (Map.Entry entry : attributes.entrySet()) {
QName qname = entry.getKey();
writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), entry.getValue());
}
}
writer.writeStartElement(version.getPrefix(), version.eprType.address, version.nsUri);
writer.writeCharacters(address);
writer.writeEndElement();
//When the size of ReferenceParametes is zero, the ReferenceParametes element will not be written.
if(referenceParameters != null && referenceParameters.size() > 0) {
writer.writeStartElement(version.getPrefix(), version.eprType.referenceParameters, version.nsUri);
for (Element e : referenceParameters) {
DOMUtil.serializeNode(e, writer);
}
writer.writeEndElement();
}
switch (version) {
case W3C:
writeW3CMetaData(writer, service, port, portType, metadata, wsdlAddress, wsdlTargetNamespace);
break;
case MEMBER:
writeMSMetaData(writer, service, port, portType, metadata);
if (wsdlAddress != null) {
//Inline the wsdl as extensibility element
//Write mex:Metadata wrapper
writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA.getPrefix(),
MemberSubmissionAddressingConstants.MEX_METADATA.getLocalPart(),
MemberSubmissionAddressingConstants.MEX_METADATA.getNamespaceURI());
writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getPrefix(),
MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getLocalPart(),
MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getNamespaceURI());
writer.writeAttribute(MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_ATTRIBUTE,
MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_VALUE);
writeWsdl(writer, service, wsdlAddress);
writer.writeEndElement();
writer.writeEndElement();
}
break;
}
}
private static boolean isEmty(QName qname) {
return qname == null || qname.toString().trim().length()== 0;
}
private static void writeW3CMetaData(StreamWriterBufferCreator writer,
QName service,
QName port,
QName portType, List metadata,
String wsdlAddress, String wsdlTargetNamespace) throws XMLStreamException {
//.NET treate empty metaData element as bad request.
if (isEmty(service) && isEmty(port) && isEmty(portType) && metadata == null/* && wsdlAddress == null*/) {
return;
}
writer.writeStartElement(AddressingVersion.W3C.getPrefix(),
AddressingVersion.W3C.eprType.wsdlMetadata.getLocalPart(), AddressingVersion.W3C.nsUri);
writer.writeNamespace(AddressingVersion.W3C.getWsdlPrefix(),
AddressingVersion.W3C.wsdlNsUri);
//write wsdliLication as defined in WS-Addressing 1.0 Metadata spec
if(wsdlAddress != null) {
writeWsdliLocation(writer, service, wsdlAddress, wsdlTargetNamespace);
}
//Write Interface info
if (portType != null) {
writer.writeStartElement(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
AddressingVersion.W3C.eprType.portTypeName,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
String portTypePrefix = portType.getPrefix();
if (portTypePrefix == null || portTypePrefix.equals("")) {
//TODO check prefix again
portTypePrefix = "wsns";
}
writer.writeNamespace(portTypePrefix, portType.getNamespaceURI());
writer.writeCharacters(portTypePrefix + ":" + portType.getLocalPart());
writer.writeEndElement();
}
if (service != null) {
//Write service and Port info
if (!(service.getNamespaceURI().equals("") || service.getLocalPart().equals(""))) {
writer.writeStartElement(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
AddressingVersion.W3C.eprType.serviceName,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
String servicePrefix = service.getPrefix();
if (servicePrefix == null || servicePrefix.equals("")) {
//TODO check prefix again
servicePrefix = "wsns";
}
writer.writeNamespace(servicePrefix, service.getNamespaceURI());
if (port != null) {
writer.writeAttribute(AddressingVersion.W3C.eprType.portName, port.getLocalPart());
}
writer.writeCharacters(servicePrefix + ":" + service.getLocalPart());
writer.writeEndElement();
}
}
/*
//Inline the wsdl
if (wsdlAddress != null) {
writeWsdl(writer, service, wsdlAddress);
}
*/
//Add the extra metadata Elements
if (metadata != null) {
for (Element e : metadata) {
DOMUtil.serializeNode(e, writer);
}
}
writer.writeEndElement();
}
/**
* @param writer the writer should be at the start of element.
* @param service Namespace URI of servcie is used as targetNamespace of wsdl if wsdlTargetNamespace is not null
* @param wsdlAddress wsdl location
* @param wsdlTargetNamespace targetnamespace of wsdl to be put in wsdliLocation
*
*/
private static void writeWsdliLocation(StreamWriterBufferCreator writer, QName service,String wsdlAddress,String wsdlTargetNamespace) throws XMLStreamException {
String wsdliLocation = "";
if(wsdlTargetNamespace != null) {
wsdliLocation = wsdlTargetNamespace + " ";
} else if (service != null) {
wsdliLocation = service.getNamespaceURI() + " ";
} else {
throw new WebServiceException("WSDL target Namespace cannot be resolved");
}
wsdliLocation += wsdlAddress;
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_PREFIX,
W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_NAMESPACE);
writer.writeAttribute(W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_PREFIX,
W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_NAMESPACE,
W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_LOCALNAME,
wsdliLocation);
}
private static void writeMSMetaData(StreamWriterBufferCreator writer,
QName service,
QName port,
QName portType, List metadata) throws XMLStreamException {
// TODO: write ReferenceProperties
//TODO: write ReferenceParameters
if (portType != null) {
//Write Interface info
writer.writeStartElement(AddressingVersion.MEMBER.getPrefix(),
AddressingVersion.MEMBER.eprType.portTypeName,
AddressingVersion.MEMBER.nsUri);
String portTypePrefix = portType.getPrefix();
if (portTypePrefix == null || portTypePrefix.equals("")) {
//TODO check prefix again
portTypePrefix = "wsns";
}
writer.writeNamespace(portTypePrefix, portType.getNamespaceURI());
writer.writeCharacters(portTypePrefix + ":" + portType.getLocalPart());
writer.writeEndElement();
}
//Write service and Port info
if (service != null) {
if (!(service.getNamespaceURI().equals("") || service.getLocalPart().equals(""))) {
writer.writeStartElement(AddressingVersion.MEMBER.getPrefix(),
AddressingVersion.MEMBER.eprType.serviceName,
AddressingVersion.MEMBER.nsUri);
String servicePrefix = service.getPrefix();
if (servicePrefix == null || servicePrefix.equals("")) {
//TODO check prefix again
servicePrefix = "wsns";
}
writer.writeNamespace(servicePrefix, service.getNamespaceURI());
if (port != null) {
writer.writeAttribute(AddressingVersion.MEMBER.eprType.portName,
port.getLocalPart());
}
writer.writeCharacters(servicePrefix + ":" + service.getLocalPart());
writer.writeEndElement();
}
}
}
private static void writeWsdl(StreamWriterBufferCreator writer, QName service, String wsdlAddress) throws XMLStreamException {
// Inline-wsdl
writer.writeStartElement(WSDLConstants.PREFIX_NS_WSDL,
WSDLConstants.QNAME_DEFINITIONS.getLocalPart(),
WSDLConstants.NS_WSDL);
writer.writeNamespace(WSDLConstants.PREFIX_NS_WSDL, WSDLConstants.NS_WSDL);
writer.writeStartElement(WSDLConstants.PREFIX_NS_WSDL,
WSDLConstants.QNAME_IMPORT.getLocalPart(),
WSDLConstants.NS_WSDL);
writer.writeAttribute("namespace", service.getNamespaceURI());
writer.writeAttribute("location", wsdlAddress);
writer.writeEndElement();
writer.writeEndElement();
}
/**
* Converts from {@link EndpointReference}.
*
* This handles null {@link EndpointReference} correctly.
* Call {@link #WSEndpointReference(EndpointReference)} directly
* if you know it's not null.
*/
public static @Nullable
WSEndpointReference create(@Nullable EndpointReference epr) {
if (epr != null) {
return new WSEndpointReference(epr);
} else {
return null;
}
}
/**
* @see #createWithAddress(String)
*/
public @NotNull WSEndpointReference createWithAddress(@NotNull URI newAddress) {
return createWithAddress(newAddress.toString());
}
/**
* @see #createWithAddress(String)
*/
public @NotNull WSEndpointReference createWithAddress(@NotNull URL newAddress) {
return createWithAddress(newAddress.toString());
}
/**
* Creates a new {@link 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));
*
*
* @param newAddress
* This is a complete URL to be written inside <Adress> element of the EPR,
* such as "http://foo.bar/abc/def"
*/
public @NotNull WSEndpointReference createWithAddress(@NotNull final String newAddress) {
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
XMLFilterImpl filter = new XMLFilterImpl() {
private boolean inAddress = false;
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
if (localName.equals("Address") && uri.equals(version.nsUri)) {
inAddress = true;
}
super.startElement(uri,localName,qName,atts);
}
@Override
public void characters(char ch[], int start, int length) throws SAXException {
if (!inAddress) {
super.characters(ch, start, length);
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (inAddress) {
super.characters(newAddress.toCharArray(),0,newAddress.length());
}
inAddress = false;
super.endElement(uri, localName, qName);
}
};
filter.setContentHandler(xsb.createFromSAXBufferCreator());
try {
infoset.writeTo(filter,false);
} catch (SAXException e) {
throw new AssertionError(e); // impossible since we are writing from XSB to XSB.
}
return new WSEndpointReference(xsb,version);
}
/**
* Convert the EPR to the spec version. The actual type of
* {@link EndpointReference} to 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.)
*/
public @NotNull EndpointReference toSpec() {
return ProviderImpl.INSTANCE.readEndpointReference(asSource("EndpointReference"));
}
/**
* Converts the EPR to the specified spec version.
*
* If the {@link #getVersion() the addressing version in use} and
* the given class is different, then this may involve version conversion.
*/
public @NotNull T toSpec(Class clazz) {
return EndpointReferenceUtil.transform(clazz,toSpec());
}
/**
* 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 {@link #getAddress() the address},
* and sending the reference parameters associated with this EPR as
* headers, etc.
*/
public @NotNull T getPort(@NotNull Service jaxwsService,
@NotNull Class serviceEndpointInterface,
WebServiceFeature... features) {
// TODO: implement it in a better way
return jaxwsService.getPort(toSpec(),serviceEndpointInterface,features);
}
/**
* Creates a {@link 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 {@link #getAddress() the address},
* and sending the reference parameters associated with this EPR as
* headers, etc.
*/
public @NotNull Dispatch createDispatch(
@NotNull Service jaxwsService,
@NotNull Class type,
@NotNull Service.Mode mode,
WebServiceFeature... features) {
// TODO: implement it in a better way
return jaxwsService.createDispatch(toSpec(),type,mode,features);
}
/**
* Creates a {@link 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 {@link #getAddress() the address},
* and sending the reference parameters associated with this EPR as
* headers, etc.
*/
public @NotNull Dispatch