javax.xml.ws.EndpointReference Java Examples
The following examples show how to use
javax.xml.ws.EndpointReference.
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: EndpointReferenceUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Gives the EPR based on the clazz. It may need to perform tranformation from * W3C EPR to MS EPR or vise-versa. */ public static <T extends EndpointReference> T transform(Class<T> clazz, @NotNull EndpointReference epr) { assert epr != null; if (clazz.isAssignableFrom(W3CEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) epr; } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) toW3CEpr((MemberSubmissionEndpointReference) epr); } } else if (clazz.isAssignableFrom(MemberSubmissionEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) toMSEpr((W3CEndpointReference) epr); } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) epr; } } //This must be an EPR that we dont know throw new WebServiceException("Unknwon EndpointReference: " + epr.getClass()); }
Example #2
Source File: EndpointReferenceUtil.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Gives the EPR based on the clazz. It may need to perform tranformation from * W3C EPR to MS EPR or vise-versa. */ public static <T extends EndpointReference> T transform(Class<T> clazz, @NotNull EndpointReference epr) { assert epr != null; if (clazz.isAssignableFrom(W3CEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) epr; } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) toW3CEpr((MemberSubmissionEndpointReference) epr); } } else if (clazz.isAssignableFrom(MemberSubmissionEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) toMSEpr((W3CEndpointReference) epr); } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) epr; } } //This must be an EPR that we dont know throw new WebServiceException("Unknwon EndpointReference: " + epr.getClass()); }
Example #3
Source File: EndpointReferenceUtil.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Gives the EPR based on the clazz. It may need to perform tranformation from * W3C EPR to MS EPR or vise-versa. */ public static <T extends EndpointReference> T transform(Class<T> clazz, @NotNull EndpointReference epr) { assert epr != null; if (clazz.isAssignableFrom(W3CEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) epr; } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) toW3CEpr((MemberSubmissionEndpointReference) epr); } } else if (clazz.isAssignableFrom(MemberSubmissionEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) toMSEpr((W3CEndpointReference) epr); } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) epr; } } //This must be an EPR that we dont know throw new WebServiceException("Unknwon EndpointReference: " + epr.getClass()); }
Example #4
Source File: ServiceFactory.java From development with Apache License 2.0 | 6 votes |
private EndpointReference determineEndpointReference(String serviceName) throws ParserConfigurationException { Document doc = DocumentBuilderFactory.newInstance() .newDocumentBuilder().newDocument(); Element eprNode = doc.createElementNS( "http://www.w3.org/2005/08/addressing", "EndpointReference"); Element addressNode = doc.createElement("Address"); Element metadataNode = doc.createElement("Metadata"); String wsdlURL = remoteWSDLUrl.replace("{service}", serviceName); addressNode.setTextContent(wsdlURL); doc.appendChild(eprNode); eprNode.appendChild(addressNode); eprNode.appendChild(metadataNode); EndpointReference epr = EndpointReference.readFrom(new DOMSource(doc)); return epr; }
Example #5
Source File: EndpointReferenceTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testServiceGetPortUsingEndpointReference() throws Exception { BusFactory.setDefaultBus(getBus()); GreeterImpl greeter1 = new GreeterImpl(); try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter1, (String)null)) { endpoint.publish("http://localhost:8080/test"); javax.xml.ws.Service s = javax.xml.ws.Service .create(new QName("http://apache.org/hello_world_soap_http", "SoapPort")); InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml"); Document doc = StaxUtils.read(is); DOMSource erXML = new DOMSource(doc); EndpointReference endpointReference = EndpointReference.readFrom(erXML); WebServiceFeature[] wfs = new WebServiceFeature[] {}; Greeter greeter = s.getPort(endpointReference, Greeter.class, wfs); String response = greeter.greetMe("John"); assertEquals("Hello John", response); } }
Example #6
Source File: EndpointReferenceUtil.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Gives the EPR based on the clazz. It may need to perform tranformation from * W3C EPR to MS EPR or vise-versa. */ public static <T extends EndpointReference> T transform(Class<T> clazz, @NotNull EndpointReference epr) { assert epr != null; if (clazz.isAssignableFrom(W3CEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) epr; } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) toW3CEpr((MemberSubmissionEndpointReference) epr); } } else if (clazz.isAssignableFrom(MemberSubmissionEndpointReference.class)) { if (epr instanceof W3CEndpointReference) { return (T) toMSEpr((W3CEndpointReference) epr); } else if (epr instanceof MemberSubmissionEndpointReference) { return (T) epr; } } //This must be an EPR that we dont know throw new WebServiceException("Unknwon EndpointReference: " + epr.getClass()); }
Example #7
Source File: Client.java From cxf with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { //Use WS-Discovery to find references to services that implement the Greeter portType WSDiscoveryClient client = new WSDiscoveryClient(); List<EndpointReference> references = client.probe(new QName("http://cxf.apache.org/hello_world/discovery", "Greeter")); client.close(); GreeterService service = new GreeterService(); //loop through all of them and have them greet me. for (EndpointReference ref : references) { Greeter g = service.getPort(ref, Greeter.class); System.out.println(g.greetMe("World")); } }
Example #8
Source File: JaxWsProviderWrapper.java From tomee with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings({"unchecked"}) public <T> T getPort(final EndpointReference endpointReference, final Class<T> serviceEndpointInterface, final WebServiceFeature... features) { return (T) invoke21Delegate(serviceDelegate, serviceGetPortByEndpointReference, endpointReference, serviceEndpointInterface, features); }
Example #9
Source File: WSEndpointImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, List<Element> metadata, List<Element> referenceParameters) { QName portType = null; if (port != null) { portType = port.getBinding().getPortTypeName(); } AddressingVersion av = AddressingVersion.fromSpecClass(clazz); return new WSEndpointReference( av, address, serviceName, portName, portType, metadata, wsdlAddress, referenceParameters, endpointReferenceExtensions.values(), null).toSpec(clazz); }
Example #10
Source File: AddressingVersion.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public EPR(Class<? extends EndpointReference> eprClass, String address, String serviceName, String portName, String portTypeName, QName wsdlMetadata, String referenceParameters, String referenceProperties) { this.eprClass = eprClass; this.address = address; this.serviceName = serviceName; this.portName = portName; this.portTypeName = portTypeName; this.referenceParameters = referenceParameters; this.referenceProperties = referenceProperties; this.wsdlMetadata = wsdlMetadata; }
Example #11
Source File: WSEndpointReference.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Creates from the spec version of {@link EndpointReference}. * * <p> * 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); } }
Example #12
Source File: EndpointReferenceTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testBindingProviderSOAPBindingStaicService() throws Exception { org.apache.hello_world_soap_http.SOAPService s = new org.apache.hello_world_soap_http.SOAPService(); 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 #13
Source File: WSEndpointReference.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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; } }
Example #14
Source File: AbstractWebServiceContext.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getEndpointReference() can only be called while servicing a request"); } String address = packet.webServiceContextDelegate.getEPRAddress(packet, endpoint); String wsdlAddress = null; if(endpoint.getServiceDefinition() != null) { wsdlAddress = packet.webServiceContextDelegate.getWSDLAddress(packet,endpoint); } return clazz.cast(endpoint.getEndpointReference(clazz,address,wsdlAddress, referenceParameters)); }
Example #15
Source File: ProviderImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public EndpointReference readEndpointReference(final Source eprInfoset) { try { Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); return (EndpointReference) unmarshaller.unmarshal(eprInfoset); } catch (JAXBException e) { throw new WebServiceException("Error creating Marshaller or marshalling.", e); } }
Example #16
Source File: WSEndpointReference.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates from the spec version of {@link EndpointReference}. * * <p> * 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); } }
Example #17
Source File: AbstractWebServiceContext.java From hottub with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getEndpointReference() can only be called while servicing a request"); } String address = packet.webServiceContextDelegate.getEPRAddress(packet, endpoint); String wsdlAddress = null; if(endpoint.getServiceDefinition() != null) { wsdlAddress = packet.webServiceContextDelegate.getWSDLAddress(packet,endpoint); } return clazz.cast(endpoint.getEndpointReference(clazz,address,wsdlAddress, referenceParameters)); }
Example #18
Source File: AbstractWebServiceContext.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getEndpointReference() can only be called while servicing a request"); } String address = packet.webServiceContextDelegate.getEPRAddress(packet, endpoint); String wsdlAddress = null; if(endpoint.getServiceDefinition() != null) { wsdlAddress = packet.webServiceContextDelegate.getWSDLAddress(packet,endpoint); } return clazz.cast(endpoint.getEndpointReference(clazz,address,wsdlAddress, referenceParameters)); }
Example #19
Source File: WSEndpointImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, List<Element> metadata, List<Element> referenceParameters) { QName portType = null; if (port != null) { portType = port.getBinding().getPortTypeName(); } AddressingVersion av = AddressingVersion.fromSpecClass(clazz); return new WSEndpointReference( av, address, serviceName, portName, portType, metadata, wsdlAddress, referenceParameters, endpointReferenceExtensions.values(), null).toSpec(clazz); }
Example #20
Source File: AbstractWebServiceContext.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getEndpointReference() can only be called while servicing a request"); } String address = packet.webServiceContextDelegate.getEPRAddress(packet, endpoint); String wsdlAddress = null; if(endpoint.getServiceDefinition() != null) { wsdlAddress = packet.webServiceContextDelegate.getWSDLAddress(packet,endpoint); } return clazz.cast(endpoint.getEndpointReference(clazz,address,wsdlAddress, referenceParameters)); }
Example #21
Source File: WSEndpointReference.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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; } }
Example #22
Source File: AbstractWebServiceContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getEndpointReference() can only be called while servicing a request"); } String address = packet.webServiceContextDelegate.getEPRAddress(packet, endpoint); String wsdlAddress = null; if(endpoint.getServiceDefinition() != null) { wsdlAddress = packet.webServiceContextDelegate.getWSDLAddress(packet,endpoint); } return clazz.cast(endpoint.getEndpointReference(clazz,address,wsdlAddress, referenceParameters)); }
Example #23
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 #24
Source File: ProviderImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public EndpointReference readEndpointReference(final Source eprInfoset) { try { Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); return (EndpointReference) unmarshaller.unmarshal(eprInfoset); } catch (JAXBException e) { throw new WebServiceException("Error creating Marshaller or marshalling.", e); } }
Example #25
Source File: WSEndpointReference.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Creates from the spec version of {@link EndpointReference}. * * <p> * 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); } }
Example #26
Source File: WSEndpointImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, Element... referenceParameters) { List<Element> refParams = null; if (referenceParameters != null) { refParams = Arrays.asList(referenceParameters); } return getEndpointReference(clazz, address, wsdlAddress, null, refParams); }
Example #27
Source File: WSEndpointImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, String address, String wsdlAddress, Element... referenceParameters) { List<Element> refParams = null; if (referenceParameters != null) { refParams = Arrays.asList(referenceParameters); } return getEndpointReference(clazz, address, wsdlAddress, null, refParams); }
Example #28
Source File: AbstractWebServiceContext.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element...referenceParameters) { Packet packet = getRequestPacket(); if (packet == null) { throw new IllegalStateException("getEndpointReference() can only be called while servicing a request"); } String address = packet.webServiceContextDelegate.getEPRAddress(packet, endpoint); String wsdlAddress = null; if(endpoint.getServiceDefinition() != null) { wsdlAddress = packet.webServiceContextDelegate.getWSDLAddress(packet,endpoint); } return clazz.cast(endpoint.getEndpointReference(clazz,address,wsdlAddress, referenceParameters)); }
Example #29
Source File: WSServiceDelegate.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public Dispatch<Object> createDispatch(EndpointReference endpointReference, JAXBContext context, Service.Mode mode, WebServiceFeature... features) { WSEndpointReference wsepr = new WSEndpointReference(endpointReference); QName portName = addPortEpr(wsepr); return createDispatch(portName, wsepr, context, mode, features); }
Example #30
Source File: ProviderWrapperTest.java From tomee with Apache License 2.0 | 4 votes |
public EndpointReference readEndpointReference(final Source source) { return null; }