org.apache.cxf.endpoint.dynamic.DynamicClientFactory Java Examples

The following examples show how to use org.apache.cxf.endpoint.dynamic.DynamicClientFactory. 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: ClientServerTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@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]);
}
 
Example #2
Source File: DynamicClientEndpointCreationLoop.java    From cxf with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #3
Source File: AegisClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #4
Source File: ClientServerPartialWsdlTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@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]);
}
 
Example #5
Source File: ClientServerPartialWsdlTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCXF4676partial2() throws Exception {
    DynamicClientFactory dcf = DynamicClientFactory.newInstance();
    Client client = dcf.createClient("http://localhost:"
        + PORT + "/AddNumbersImplPartial2Service?wsdl", serviceName2, portName2);
    updateAddressPort(client, PORT);
    Object[] result = client.invoke("addTwoNumbers", 10, 20);
    assertNotNull("no response received from service", result);
    assertEquals(30, result[0]);

}
 
Example #6
Source File: ClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@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);
}