Search in sources :

Example 1 with DynamicClientFactory

use of org.apache.cxf.endpoint.dynamic.DynamicClientFactory in project cxf by apache.

the class ClientServerTest method testBase64.

@Test
public void testBase64() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl");
    assertNotNull(wsdl);
    String wsdlUrl = null;
    wsdlUrl = wsdl.toURI().toString();
    CXFBusFactory busFactory = new CXFBusFactory();
    Bus bus = busFactory.createBus();
    DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus);
    Client client = dynamicClientFactory.createClient(wsdlUrl);
    assertNotNull(client);
}
Also used : Bus(org.apache.cxf.Bus) DynamicClientFactory(org.apache.cxf.endpoint.dynamic.DynamicClientFactory) Client(org.apache.cxf.endpoint.Client) URL(java.net.URL) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) SOAPServiceMultiPortTypeTest(org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest) SOAPServiceBogusAddressTest(org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest) Test(org.junit.Test)

Example 2 with DynamicClientFactory

use of org.apache.cxf.endpoint.dynamic.DynamicClientFactory in project cxf by apache.

the class ClientServerTest method testDynamicClientFactory.

@Test
public void testDynamicClientFactory() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(wsdl);
    String wsdlUrl = null;
    wsdlUrl = wsdl.toURI().toString();
    DynamicClientFactory dcf = DynamicClientFactory.newInstance();
    Client client = dcf.createClient(wsdlUrl, serviceName, portName);
    updateAddressPort(client, PORT);
    client.invoke("greetMe", "test");
    Object[] result = client.invoke("sayHi");
    assertNotNull("no response received from service", result);
    assertEquals("Bonjour", result[0]);
    client = dcf.createClient(wsdlUrl, serviceName, portName);
    new LoggingFeature().initialize(client, client.getBus());
    updateAddressPort(client, PORT);
    client.invoke("greetMe", "test");
    result = client.invoke("sayHi");
    assertNotNull("no response received from service", result);
    assertEquals("Bonjour", result[0]);
}
Also used : DynamicClientFactory(org.apache.cxf.endpoint.dynamic.DynamicClientFactory) LoggingFeature(org.apache.cxf.ext.logging.LoggingFeature) Client(org.apache.cxf.endpoint.Client) URL(java.net.URL) SOAPServiceMultiPortTypeTest(org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest) SOAPServiceBogusAddressTest(org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest) Test(org.junit.Test)

Example 3 with DynamicClientFactory

use of org.apache.cxf.endpoint.dynamic.DynamicClientFactory in project cxf by apache.

the class ClientServerPartialWsdlTest method testCXF4676Partial1.

@Test
public void testCXF4676Partial1() throws Exception {
    DynamicClientFactory dcf = DynamicClientFactory.newInstance();
    Client client = dcf.createClient("http://localhost:" + PORT + "/AddNumbersImplPartial1Service?wsdl", serviceName1, portName1);
    updateAddressPort(client, PORT);
    Object[] result = client.invoke("addTwoNumbers", 10, 20);
    assertNotNull("no response received from service", result);
    assertEquals(30, result[0]);
}
Also used : DynamicClientFactory(org.apache.cxf.endpoint.dynamic.DynamicClientFactory) Client(org.apache.cxf.endpoint.Client) Test(org.junit.Test)

Example 4 with DynamicClientFactory

use of org.apache.cxf.endpoint.dynamic.DynamicClientFactory in project cxf by apache.

the class AegisClientServerTest method testDynamicClient.

@Test
public void testDynamicClient() throws Exception {
    DynamicClientFactory dcf = DynamicClientFactory.newInstance();
    Client client = dcf.createClient("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl&dynamic");
    Object r = client.invoke("getAttributeBean")[0];
    Method getAddrPlainString = r.getClass().getMethod("getAttrPlainString");
    String s = (String) getAddrPlainString.invoke(r);
    assertEquals("attrPlain", s);
}
Also used : DynamicClientFactory(org.apache.cxf.endpoint.dynamic.DynamicClientFactory) Method(java.lang.reflect.Method) Client(org.apache.cxf.endpoint.Client) Test(org.junit.Test)

Example 5 with DynamicClientFactory

use of org.apache.cxf.endpoint.dynamic.DynamicClientFactory in project cxf by apache.

the class DynamicClientEndpointCreationLoop method iteration.

private void iteration() throws URISyntaxException {
    URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl");
    String wsdlUrl = null;
    wsdlUrl = wsdl.toURI().toString();
    DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus);
    Client client = dynamicClientFactory.createClient(wsdlUrl);
    client.destroy();
}
Also used : DynamicClientFactory(org.apache.cxf.endpoint.dynamic.DynamicClientFactory) Client(org.apache.cxf.endpoint.Client) URL(java.net.URL)

Aggregations

Client (org.apache.cxf.endpoint.Client)6 DynamicClientFactory (org.apache.cxf.endpoint.dynamic.DynamicClientFactory)6 Test (org.junit.Test)5 URL (java.net.URL)3 SOAPServiceBogusAddressTest (org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest)2 SOAPServiceMultiPortTypeTest (org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest)2 Method (java.lang.reflect.Method)1 Bus (org.apache.cxf.Bus)1 CXFBusFactory (org.apache.cxf.bus.CXFBusFactory)1 LoggingFeature (org.apache.cxf.ext.logging.LoggingFeature)1