Search in sources :

Example 1 with Names

use of org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names in project cxf by apache.

the class SpringBeansTest method testNamespaceMapping.

private void testNamespaceMapping(ApplicationContext ctx) throws Exception {
    AnonymousComplexType act = (AnonymousComplexType) ctx.getBean("bookClient");
    Client client = ClientProxy.getClient(act);
    assertNotNull(act);
    StringWriter logWriter = new StringWriter();
    PrintWriter writer = new PrintWriter(logWriter);
    LoggingInInterceptor spy = new LoggingInInterceptor(writer);
    client.getInInterceptors().add(spy);
    Names n = act.splitName("Hello There");
    assertEquals("Hello", n.getFirst());
    assertTrue(logWriter.toString().contains("BeepBeep:"));
}
Also used : Names(org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names) StringWriter(java.io.StringWriter) AnonymousComplexType(org.apache.cxf.anonymous_complex_type.AnonymousComplexType) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Client(org.apache.cxf.endpoint.Client) PrintWriter(java.io.PrintWriter)

Example 2 with Names

use of org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names in project cxf by apache.

the class ClientServerMiscTest method testAnonymousComplexType.

@Test
public void testAnonymousComplexType() throws Exception {
    AnonymousComplexTypeService actService = new AnonymousComplexTypeService();
    assertNotNull(actService);
    QName portName = new QName("http://cxf.apache.org/anonymous_complex_type/", "anonymous_complex_typeSOAP");
    AnonymousComplexType act = actService.getPort(portName, AnonymousComplexType.class);
    updateAddressPort(act, PORT);
    try {
        Names reply = act.splitName("Tom Li");
        assertNotNull("no response received from service", reply);
        assertEquals("Tom", reply.getFirst());
        assertEquals("Li", reply.getSecond());
    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }
}
Also used : Names(org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names) QName(javax.xml.namespace.QName) AnonymousComplexType(org.apache.cxf.anonymous_complex_type.AnonymousComplexType) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) AnonymousComplexTypeService(org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeService) JaxbElementTest(org.apache.cxf.jaxb_element_test.JaxbElementTest) Test(org.junit.Test)

Aggregations

AnonymousComplexType (org.apache.cxf.anonymous_complex_type.AnonymousComplexType)2 Names (org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names)2 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 QName (javax.xml.namespace.QName)1 AnonymousComplexTypeService (org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeService)1 Client (org.apache.cxf.endpoint.Client)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 JaxbElementTest (org.apache.cxf.jaxb_element_test.JaxbElementTest)1 Test (org.junit.Test)1