use of com.sun.xml.ws.addressing.WSEPRExtension in project metro-jax-ws by eclipse-ee4j.
the class Stub method getWSEndpointReference.
@Override
public final WSEndpointReference getWSEndpointReference() {
if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
throw new java.lang.UnsupportedOperationException(ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding"));
}
if (endpointReference != null) {
return endpointReference;
}
String eprAddress = requestContext.getEndpointAddress().toString();
QName portTypeName = null;
String wsdlAddress = null;
List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<>();
if (wsdlPort != null) {
portTypeName = wsdlPort.getBinding().getPortTypeName();
wsdlAddress = eprAddress + "?wsdl";
// gather EPRExtensions specified in WSDL.
try {
WSEndpointReference wsdlEpr = wsdlPort.getEPR();
if (wsdlEpr != null) {
for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
wsdlEPRExtensions.add(new WSEPRExtension(XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
}
}
} catch (XMLStreamException ex) {
throw new WebServiceException(ex);
}
}
AddressingVersion av = AddressingVersion.W3C;
this.endpointReference = new WSEndpointReference(av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);
return this.endpointReference;
}
use of com.sun.xml.ws.addressing.WSEPRExtension in project metro-jax-ws by eclipse-ee4j.
the class WSEndpointReference method parseEPRExtensions.
private void parseEPRExtensions() throws XMLStreamException {
rootEprExtensions = new HashMap<>();
StreamReaderBufferProcessor xsr = infoset.readAsXMLStreamReader();
// parser should be either at the start element or the start document
if (xsr.getEventType() == XMLStreamReader.START_DOCUMENT) {
xsr.nextTag();
}
assert xsr.getEventType() == XMLStreamReader.START_ELEMENT;
if (!xsr.getNamespaceURI().equals(version.nsUri)) {
throw new WebServiceException(AddressingMessages.WRONG_ADDRESSING_VERSION(version.nsUri, xsr.getNamespaceURI()));
}
// since often EPR doesn't have extensions, create array lazily
XMLStreamBuffer mark;
String localName;
String ns;
while ((mark = xsr.nextTagAndMark()) != null) {
localName = xsr.getLocalName();
ns = xsr.getNamespaceURI();
if (version.nsUri.equals(ns)) {
// EPR extensions do not use the same namespace of the Addressing Version.
// Not an extension - SKIP
XMLStreamReaderUtil.skipElement(xsr);
} else {
QName qn = new QName(ns, localName);
rootEprExtensions.put(qn, new WSEPRExtension(mark, qn));
XMLStreamReaderUtil.skipElement(xsr);
}
}
// hit to </EndpointReference> by now
}
Aggregations