javax.xml.ws.wsaddressing.W3CEndpointReference Java Examples
The following examples show how to use
javax.xml.ws.wsaddressing.W3CEndpointReference.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiplexClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testWithGetPortExtensionHttp() throws Exception { NumberFactoryService service = new NumberFactoryService(); NumberFactory factory = service.getNumberFactoryPort(); updateAddressPort(factory, PORT); NumberService numService = new NumberService(); ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService); W3CEndpointReference numberTwoRef = factory.create("20"); assertNotNull("reference", numberTwoRef); Number num = serviceImpl.getPort(numberTwoRef, Number.class); assertTrue("20 is even", num.isEven().isEven()); close(num); W3CEndpointReference numberTwentyThreeRef = factory.create("23"); num = serviceImpl.getPort(numberTwentyThreeRef, Number.class); assertFalse("23 is not even", num.isEven().isEven()); close(num); close(factory); }
Example #2
Source File: MultiplexHttpAddressClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testWithGetPortExtensionHttp() throws Exception { NumberFactoryService service = new NumberFactoryService(); NumberFactory factory = service.getNumberFactoryPort(); updateAddressPort(factory, PORT); NumberService numService = new NumberService(); ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService); W3CEndpointReference numberTwoRef = factory.create("20"); assertNotNull("reference", numberTwoRef); Number num = serviceImpl.getPort(numberTwoRef, Number.class); assertTrue("20 is even", num.isEven().isEven()); W3CEndpointReference numberTwentyThreeRef = factory.create("23"); num = serviceImpl.getPort(numberTwentyThreeRef, Number.class); assertFalse("23 is not even", num.isEven().isEven()); }
Example #3
Source File: ProviderImplTest.java From cxf with Apache License 2.0 | 6 votes |
@org.junit.Test public void testCreateW3CEpr() throws Exception { QName serviceName = new QName("http://cxf.apache.org", "ServiceName"); QName portName = new QName("http://cxf.apache.org", "PortName"); ProviderImpl impl = new ProviderImpl(); W3CEndpointReference w3Epr = impl.createW3CEndpointReference("http://myaddress", serviceName, portName, null, "wsdlLoc", null); java.io.StringWriter sw = new java.io.StringWriter(); StreamResult result = new StreamResult(sw); w3Epr.writeTo(result); String expected = "<wsdl:definitions"; assertTrue("Embeded wsdl element is not generated", sw.toString().indexOf(expected) > -1); assertTrue("wsdlLocation attribute has the wrong value", sw.toString().contains(":wsdlLocation=\"http://cxf.apache.org wsdlLoc\"")); }
Example #4
Source File: JaxWsEndpointImpl.java From cxf with Apache License 2.0 | 6 votes |
private void extractWsdlEprs(EndpointInfo endpoint) { //parse the EPR in wsdl List<ExtensibilityElement> portExtensors = endpoint.getExtensors(ExtensibilityElement.class); if (portExtensors != null) { Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator(); QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference"); while (extensionElements.hasNext()) { ExtensibilityElement ext = extensionElements.next(); if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) { DOMSource domSource = new DOMSource(((UnknownExtensibilityElement)ext).getElement()); W3CEndpointReference w3cEPR = new W3CEndpointReference(domSource); EndpointReferenceType ref = ProviderImpl.convertToInternal(w3cEPR); endpoint.getTarget().setMetadata(ref.getMetadata()); endpoint.getTarget().setReferenceParameters(ref.getReferenceParameters()); endpoint.getTarget().getOtherAttributes().putAll(ref.getOtherAttributes()); } } } }
Example #5
Source File: ProviderImplTest.java From cxf with Apache License 2.0 | 6 votes |
@org.junit.Test public void testCreateW3CEprMetadataMetadataOnly() throws Exception { ProviderImpl impl = new ProviderImpl(); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Element element = builder.newDocument().createElement("customMetadata"); List<Element> metadata = new ArrayList<>(); metadata.add(element); W3CEndpointReference w3Epr = impl.createW3CEndpointReference( "http://myaddress", null, null, metadata, null, null); java.io.StringWriter sw = new java.io.StringWriter(); StreamResult result = new StreamResult(sw); w3Epr.writeTo(result); assertTrue("Address is expected", sw.toString().contains("Address")); assertTrue("Metadata element expected", sw.toString().contains("Metadata")); assertTrue("Custom Metadata element expected", sw.toString().contains("customMetadata")); assertFalse("Interface element unexpected", sw.toString().contains("Interface")); assertFalse("ServiceName unexpected", sw.toString().contains("ServiceName")); }
Example #6
Source File: WSDiscoveryServiceImpl.java From cxf with Apache License 2.0 | 6 votes |
private ResolveMatchesType handleResolve(ResolveType resolve) { ResolveMatchType rmt = new ResolveMatchType(); EndpointReference ref = resolve.getEndpointReference(); EndpointReferenceType iref = ProviderImpl.convertToInternal(ref); for (HelloType hello : registered) { W3CEndpointReference r = hello.getEndpointReference(); if (matches(iref, r)) { rmt.setEndpointReference(r); rmt.setScopes(hello.getScopes()); rmt.getTypes().addAll(hello.getTypes()); rmt.getXAddrs().addAll(hello.getXAddrs()); rmt.getOtherAttributes().putAll(hello.getOtherAttributes()); rmt.setMetadataVersion(hello.getMetadataVersion()); ResolveMatchesType rmts = new ResolveMatchesType(); rmts.setResolveMatch(rmt); return rmts; } } return null; }
Example #7
Source File: EndpointReferenceTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testBindingProviderSOAPBinding() throws Exception { javax.xml.ws.Service s = javax.xml.ws.Service .create(new QName("http://apache.org/hello_world_soap_http", "SoapPort")); assertNotNull(s); Greeter greeter = s.getPort(Greeter.class); BindingProvider bindingProvider = (BindingProvider)greeter; EndpointReference er = bindingProvider.getEndpointReference(); assertNotNull(er); //If the BindingProvider instance has a binding that is either SOAP 1.1/HTTP or SOAP //1.2/HTTP, then a W3CEndpointReference MUST be returned. assertTrue(er instanceof W3CEndpointReference); }
Example #8
Source File: Stub.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public final W3CEndpointReference getEndpointReference() { if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) { throw new java.lang.UnsupportedOperationException( ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")); } return getEndpointReference(W3CEndpointReference.class); }
Example #9
Source File: EndpointReferenceTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testProviderReadEndpointReference() throws Exception { ProviderImpl provider = new ProviderImpl(); InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml"); Document doc = StaxUtils.read(is); DOMSource erXML = new DOMSource(doc); EndpointReference endpointReference = provider.readEndpointReference(erXML); assertNotNull(endpointReference); assertTrue(endpointReference instanceof W3CEndpointReference); }
Example #10
Source File: AbstractNotificationBroker.java From cxf with Apache License 2.0 | 5 votes |
protected void handleNotify(Notify notify) { for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) { W3CEndpointReference producerReference = messageHolder.getProducerReference(); AbstractPublisher publisher = getPublisher(producerReference); if (publisher != null) { publisher.notify(messageHolder); } } }
Example #11
Source File: Stub.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public final W3CEndpointReference getEndpointReference() { if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) { throw new java.lang.UnsupportedOperationException( ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")); } return getEndpointReference(W3CEndpointReference.class); }
Example #12
Source File: LocatorClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testLookupEndpointAndVerifyWsdlLocationAndNamespace() throws Exception { URL wsdl = getClass().getResource("/wsdl/locator.wsdl"); assertNotNull(wsdl); LocatorService_Service ss = new LocatorService_Service(wsdl, serviceName); LocatorService port = ss.getLocatorServicePort(); updateAddressPort(port, PORT); W3CEndpointReference epr = port.lookupEndpoint(new QName("http://service/1", "Number")); String eprString = epr.toString(); assertTrue(eprString.contains("Metadata")); assertTrue(eprString.contains("wsdlLocation=\"http://service/1 wsdlLoc\"")); }
Example #13
Source File: EndpointImpl.java From cxf with Apache License 2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { if (W3CEndpointReference.class.isAssignableFrom(clazz)) { return clazz.cast(getEndpointReference(referenceParameters)); } throw new WebServiceException(new org.apache.cxf.common.i18n.Message( "ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED", LOG, clazz .getName()).toString()); }
Example #14
Source File: ProviderImpl.java From cxf with Apache License 2.0 | 5 votes |
public W3CEndpointReference createW3CEndpointReference(String address, QName serviceName, QName portName, List<Element> metadata, String wsdlDocumentLocation, List<Element> referenceParameters) { return createW3CEndpointReference(address, null, serviceName, portName, metadata, wsdlDocumentLocation, referenceParameters, null, null); }
Example #15
Source File: ProviderImpl.java From cxf with Apache License 2.0 | 5 votes |
private static JAXBContext getJAXBContext() { if (jaxbContext == null) { try { jaxbContext = JAXBContext.newInstance(W3CEndpointReference.class); } catch (JAXBException e) { throw new WebServiceException(new Message("JAXBCONTEXT_CREATION_FAILED", LOG).toString(), e); } } return jaxbContext; }
Example #16
Source File: ProviderImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static JAXBContext getEPRJaxbContext() { // EPRs have package and private fields, so we need privilege escalation. // this access only fixed, known set of classes, so doing that // shouldn't introduce security vulnerability. return AccessController.doPrivileged(new PrivilegedAction<JAXBContext>() { public JAXBContext run() { try { return JAXBContext.newInstance(MemberSubmissionEndpointReference.class, W3CEndpointReference.class); } catch (JAXBException e) { throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e); } } }); }
Example #17
Source File: BankImpl.java From cxf with Apache License 2.0 | 5 votes |
private W3CEndpointReference createAccountReference(String accountName) { String corbaAddress = "corbaname::localhost:1050#" + accountName; Object account = new AccountImpl(); Endpoint ep = Endpoint.publish(corbaAddress, account); endpointList.put(accountName, ep); return (W3CEndpointReference)ep.getEndpointReference((org.w3c.dom.Element[])null); }
Example #18
Source File: BankImpl.java From cxf with Apache License 2.0 | 5 votes |
public W3CEndpointReference createAccount(String accountName) { System.out.println("[Bank] Called createAccount( " + accountName + " )..."); System.out.println(); W3CEndpointReference ref = null; ref = createAccountReference(accountName); if (ref != null) { accountList.put(accountName, ref); } return ref; }
Example #19
Source File: ProviderImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static JAXBContext getEPRJaxbContext() { // EPRs have package and private fields, so we need privilege escalation. // this access only fixed, known set of classes, so doing that // shouldn't introduce security vulnerability. return AccessController.doPrivileged(new PrivilegedAction<JAXBContext>() { public JAXBContext run() { try { return JAXBContext.newInstance(MemberSubmissionEndpointReference.class, W3CEndpointReference.class); } catch (JAXBException e) { throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e); } } }); }
Example #20
Source File: ProviderWrapper.java From tomee with Apache License 2.0 | 5 votes |
public W3CEndpointReference createW3CEndpointReference(final String address, final QName serviceName, final QName portName, final List<Element> metadata, final String wsdlDocumentLocation, final List<Element> referenceParameters) { return (W3CEndpointReference) invoke21Delegate(delegate, createW3CEndpointReference, address, serviceName, portName, metadata, wsdlDocumentLocation, referenceParameters); }
Example #21
Source File: Stub.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public final W3CEndpointReference getEndpointReference() { if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) { throw new java.lang.UnsupportedOperationException( ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")); } return getEndpointReference(W3CEndpointReference.class); }
Example #22
Source File: WebServiceContextImpl.java From cxf with Apache License 2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { if (W3CEndpointReference.class.isAssignableFrom(clazz)) { return clazz.cast(getEndpointReference(referenceParameters)); } throw new WebServiceException(new Message("ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED", LOG, clazz.getName()).toString()); }
Example #23
Source File: ProviderImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static JAXBContext getEPRJaxbContext() { // EPRs have package and private fields, so we need privilege escalation. // this access only fixed, known set of classes, so doing that // shouldn't introduce security vulnerability. return AccessController.doPrivileged(new PrivilegedAction<JAXBContext>() { public JAXBContext run() { try { return JAXBContext.newInstance(MemberSubmissionEndpointReference.class, W3CEndpointReference.class); } catch (JAXBException e) { throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e); } } }); }
Example #24
Source File: WSDiscoveryServiceImpl.java From cxf with Apache License 2.0 | 5 votes |
private boolean matches(EndpointReferenceType ref, W3CEndpointReference r) { EndpointReferenceType cref = ProviderImpl.convertToInternal(r); QName snr = EndpointReferenceUtils.getServiceName(ref, bus); QName snc = EndpointReferenceUtils.getServiceName(cref, bus); String addr = EndpointReferenceUtils.getAddress(ref); String addc = EndpointReferenceUtils.getAddress(cref); if (addr == null) { return false; } if (addr.equals(addc)) { return !(snr != null && !snr.equals(snc)); } return false; }
Example #25
Source File: EjbMessageContext.java From tomee with Apache License 2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { if (W3CEndpointReference.class.isAssignableFrom(clazz)) { return clazz.cast(getEndpointReference(referenceParameters)); } else { throw new WebServiceException("Endpoint reference type not supported: " + clazz); } }
Example #26
Source File: Stub.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public final W3CEndpointReference getEndpointReference() { if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) { throw new java.lang.UnsupportedOperationException( ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference()", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")); } return getEndpointReference(W3CEndpointReference.class); }
Example #27
Source File: JaxWsProviderWrapperTest.java From tomee with Apache License 2.0 | 5 votes |
@Override public W3CEndpointReference createW3CEndpointReference(final String address, final QName serviceName, final QName portName, final List<Element> metadata, final String wsdlDocumentLocation, final List<Element> referenceParameters) { return null; }
Example #28
Source File: LocatorClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testLookupEndpointAndVerifyWsdlLocationOnly() throws Exception { URL wsdl = getClass().getResource("/wsdl/locator.wsdl"); assertNotNull(wsdl); LocatorService_Service ss = new LocatorService_Service(wsdl, serviceName); LocatorService port = ss.getLocatorServicePort(); updateAddressPort(port, PORT); W3CEndpointReference epr = port.lookupEndpoint(new QName("http://service/2", "Number")); String eprString = epr.toString(); assertTrue(eprString.contains("Metadata")); assertTrue(eprString.contains("wsdlLocation=\"wsdlLoc\"")); }
Example #29
Source File: BankImpl.java From cxf with Apache License 2.0 | 5 votes |
public W3CEndpointReference createEprAccount(String accountName) { System.out.println("[Bank] Called createEprAccount( " + accountName + " )..."); System.out.println(); W3CEndpointReference ref = createAccountReference(accountName); if (ref != null) { accountList.put(accountName, ref); } return ref; }
Example #30
Source File: ProviderImplTest.java From cxf with Apache License 2.0 | 5 votes |
@org.junit.Test public void testCreateW3CEprNoMetadataEmptyCustomMetadata() throws Exception { ProviderImpl impl = new ProviderImpl(); W3CEndpointReference w3Epr = impl.createW3CEndpointReference( "http://myaddress", null, null, new ArrayList<>(), null, null); java.io.StringWriter sw = new java.io.StringWriter(); StreamResult result = new StreamResult(sw); w3Epr.writeTo(result); assertTrue("Address is expected", sw.toString().contains("Address")); assertFalse("empty Metadata element should be dropped", sw.toString().contains("Metadata")); }