Search in sources :

Example 1 with ProviderImpl

use of org.apache.cxf.jaxws.spi.ProviderImpl in project cxf by apache.

the class EndpointReferenceTest method testProviderReadEndpointReference.

@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);
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) InputStream(java.io.InputStream) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ProviderImpl(org.apache.cxf.jaxws.spi.ProviderImpl) Document(org.w3c.dom.Document) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

Example 2 with ProviderImpl

use of org.apache.cxf.jaxws.spi.ProviderImpl in project cxf by apache.

the class EndpointReferenceTest method testProviderGetPort.

@Test
public void testProviderGetPort() throws Exception {
    BusFactory.setDefaultBus(getBus());
    GreeterImpl greeter1 = new GreeterImpl();
    try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter1, (String) null)) {
        endpoint.publish("http://localhost:8080/test");
        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 = EndpointReference.readFrom(erXML);
        WebServiceFeature[] wfs = new WebServiceFeature[] {};
        Greeter greeter = provider.getPort(endpointReference, Greeter.class, wfs);
        String response = greeter.greetMe("John");
        assertEquals("Hello John", response);
    }
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) InputStream(java.io.InputStream) Greeter(org.apache.hello_world_soap_http.Greeter) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) WebServiceFeature(javax.xml.ws.WebServiceFeature) ProviderImpl(org.apache.cxf.jaxws.spi.ProviderImpl) Document(org.w3c.dom.Document) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

Example 3 with ProviderImpl

use of org.apache.cxf.jaxws.spi.ProviderImpl in project cxf by apache.

the class EndpointReferenceTest method testProviderCreateW3CEndpointReference.

@Test
public void testProviderCreateW3CEndpointReference() throws Exception {
    ProviderImpl provider = new ProviderImpl();
    InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
    Document doc = StaxUtils.read(is);
    Element referenceParameter = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:ReferenceParameters", "");
    List<Element> referenceParameters = new ArrayList<>();
    if (referenceParameter != null) {
        referenceParameters.add(referenceParameter);
    }
    Element metadata = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:metadata", "");
    List<Element> metadataList = new ArrayList<>();
    if (metadata != null) {
        metadataList.add(metadata);
    }
    W3CEndpointReference endpointReference = provider.createW3CEndpointReference("http://localhost:8080/test", serviceName, portName, metadataList, "wsdlDocumentLocation", referenceParameters);
    assertNotNull(endpointReference);
}
Also used : InputStream(java.io.InputStream) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) ProviderImpl(org.apache.cxf.jaxws.spi.ProviderImpl) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)3 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)3 ProviderImpl (org.apache.cxf.jaxws.spi.ProviderImpl)3 Test (org.junit.Test)3 Document (org.w3c.dom.Document)3 DOMSource (javax.xml.transform.dom.DOMSource)2 EndpointReference (javax.xml.ws.EndpointReference)2 ArrayList (java.util.ArrayList)1 WebServiceFeature (javax.xml.ws.WebServiceFeature)1 Greeter (org.apache.hello_world_soap_http.Greeter)1 GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)1 Element (org.w3c.dom.Element)1