Search in sources :

Example 11 with EndpointReference

use of javax.xml.ws.EndpointReference in project cxf by apache.

the class EndpointReferenceTest method testEndpointGetEndpointReferenceW3C.

@Test
public void testEndpointGetEndpointReferenceW3C() throws Exception {
    GreeterImpl greeter = new GreeterImpl();
    try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter, (String) null)) {
        endpoint.publish("http://localhost:8080/test");
        InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
        Document doc = StaxUtils.read(is);
        Element referenceParameters = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:ReferenceParameters", "");
        EndpointReference endpointReference = endpoint.getEndpointReference(W3CEndpointReference.class, referenceParameters);
        assertNotNull(endpointReference);
        assertTrue(endpointReference instanceof W3CEndpointReference);
        // A returned W3CEndpointReferenceMUST also contain the specified referenceParameters.
        // W3CEndpointReference wer = (W3CEndpointReference)endpointReference;
        endpoint.stop();
    }
}
Also used : InputStream(java.io.InputStream) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Element(org.w3c.dom.Element) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) Document(org.w3c.dom.Document) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

Aggregations

EndpointReference (javax.xml.ws.EndpointReference)11 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)10 Test (org.junit.Test)9 InputStream (java.io.InputStream)6 Document (org.w3c.dom.Document)6 Greeter (org.apache.hello_world_soap_http.Greeter)5 GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)5 DOMSource (javax.xml.transform.dom.DOMSource)4 QName (javax.xml.namespace.QName)3 WebServiceFeature (javax.xml.ws.WebServiceFeature)3 BindingProvider (javax.xml.ws.BindingProvider)2 ProviderImpl (org.apache.cxf.jaxws.spi.ProviderImpl)2 Element (org.w3c.dom.Element)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Endpoint (javax.xml.ws.Endpoint)1 W3CEndpointReferenceBuilder (javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)1 SOAPService (org.apache.callback.SOAPService)1 ServerPortType (org.apache.callback.ServerPortType)1 Greeter (org.apache.cxf.hello_world.discovery.Greeter)1