Search in sources :

Example 66 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class UDPTransportTest method testFailure.

@Test
public void testFailure() throws Exception {
    if ("Mac OS X".equals(System.getProperties().getProperty("os.name")) && !JavaUtils.isJava11Compatible()) {
        // Seems to fail fairly consistently on OSX on Java 8 with newer versions of OSX
        // java11 seems to be OK
        System.out.println("Skipping failure test for OSX");
        return;
    }
    JaxWsProxyFactoryBean fact = new JaxWsProxyFactoryBean();
    fact.setAddress("udp://localhost:" + PORT);
    Greeter g = fact.create(Greeter.class);
    try {
        g.pingMe();
        fail("Expected SOAPFaultException");
    } catch (SOAPFaultException ex) {
    // expected
    }
}
Also used : Greeter(org.apache.hello_world.Greeter) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Example 67 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class UDPTransportTest method testLargeRequest.

@Test
public void testLargeRequest() throws Exception {
    JaxWsProxyFactoryBean fact = new JaxWsProxyFactoryBean();
    fact.setAddress("udp://localhost:" + PORT);
    Greeter g = fact.create(Greeter.class);
    StringBuilder b = new StringBuilder(100000);
    for (int x = 0; x < 6500; x++) {
        b.append("Hello ");
    }
    assertEquals("Hello " + b.toString(), g.greetMe(b.toString()));
    ((java.io.Closeable) g).close();
}
Also used : Greeter(org.apache.hello_world.Greeter) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 68 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class DOMToStaxRoundTripTest method createClientProxy.

private Echo createClientProxy() {
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setServiceClass(Echo.class);
    proxyFac.setAddress("local://Echo");
    proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
    return (Echo) proxyFac.create();
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 69 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class RoundTripTest method setUpService.

@Before
public void setUpService() throws Exception {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceBean(new EchoImpl());
    factory.setAddress("local://Echo");
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    Server server = factory.create();
    Service service = server.getEndpoint().getService();
    service.getInInterceptors().add(new SAAJInInterceptor());
    service.getInInterceptors().add(new LoggingInInterceptor());
    service.getOutInterceptors().add(new SAAJOutInterceptor());
    service.getOutInterceptors().add(new LoggingOutInterceptor());
    wsIn = new WSS4JInInterceptor();
    wsIn.setProperty(ConfigurationConstants.SIG_VER_PROP_FILE, "insecurity.properties");
    wsIn.setProperty(ConfigurationConstants.DEC_PROP_FILE, "insecurity.properties");
    wsIn.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName());
    service.getInInterceptors().add(wsIn);
    wsOut = new WSS4JOutInterceptor();
    wsOut.setProperty(ConfigurationConstants.SIG_PROP_FILE, "outsecurity.properties");
    wsOut.setProperty(ConfigurationConstants.ENC_PROP_FILE, "outsecurity.properties");
    wsOut.setProperty(ConfigurationConstants.USER, "myalias");
    wsOut.setProperty("password", "myAliasPassword");
    wsOut.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName());
    service.getOutInterceptors().add(wsOut);
    // Create the client
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setServiceClass(Echo.class);
    proxyFac.setAddress("local://Echo");
    proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
    echo = (Echo) proxyFac.create();
    client = ClientProxy.getClient(echo);
    client.getInInterceptors().add(new LoggingInInterceptor());
    client.getInInterceptors().add(wsIn);
    client.getInInterceptors().add(new SAAJInInterceptor());
    client.getOutInterceptors().add(new LoggingOutInterceptor());
    client.getOutInterceptors().add(wsOut);
    client.getOutInterceptors().add(new SAAJOutInterceptor());
}
Also used : SAAJInInterceptor(org.apache.cxf.binding.soap.saaj.SAAJInInterceptor) SAAJOutInterceptor(org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor) Server(org.apache.cxf.endpoint.Server) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Service(org.apache.cxf.service.Service) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Before(org.junit.Before)

Example 70 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class DOMToStaxSignatureIdentifierTest method createClientProxy.

private Echo createClientProxy() {
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setServiceClass(Echo.class);
    proxyFac.setAddress("local://Echo");
    proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
    return (Echo) proxyFac.create();
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Aggregations

JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)152 Test (org.junit.Test)71 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)21 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)19 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)14 Greeter (org.apache.hello_world_soap_http.Greeter)14 Client (org.apache.cxf.endpoint.Client)13 HashMap (java.util.HashMap)10 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)9 QName (javax.xml.namespace.QName)8 WrappedGreeter (org.apache.hello_world_soap_action.WrappedGreeter)8 BookStoreService (org.apache.cxf.systest.jaxws.tracing.BookStoreService)7 ArrayList (java.util.ArrayList)6 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)6 Holder (javax.xml.ws.Holder)5 Server (org.apache.cxf.endpoint.Server)5 Greeter (org.apache.cxf.greeter_control.Greeter)5 Service (org.apache.cxf.service.Service)5 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)5 Metadata (org.apache.cxf.ws.mex.model._2004_09.Metadata)5