Package org.apache.cxf.endpoint

Examples of org.apache.cxf.endpoint.Client


        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSignaturePort");
        DoubleItPortType x509Port =
                service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(x509Port, PORT);
       
        Client cxfClient = ClientProxy.getClient(x509Port);
        SecurityHeaderCacheInterceptor cacheInterceptor =
            new SecurityHeaderCacheInterceptor();
        cxfClient.getOutInterceptors().add(cacheInterceptor);
       
        // Make two invocations with the same security header
        x509Port.doubleIt(25);
        try {
            x509Port.doubleIt(25);
View Full Code Here


        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);
    }
View Full Code Here

        wsdlUrl = wsdl.toURI().toString();
        CXFBusFactory busFactory = new CXFBusFactory();
        Bus bus = busFactory.createBus();
        org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory dynamicClientFactory =
            org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory.newInstance(bus);
        Client client = dynamicClientFactory.createClient(wsdlUrl);
        assertNotNull(client);
    }
View Full Code Here

            assertEquals("Hello BJ", s);
            bp.getRequestContext().remove(BindingProvider.USERNAME_PROPERTY);
            bp.getRequestContext().remove(BindingProvider.PASSWORD_PROPERTY);
           
            //try setting on the conduit directly
            Client client = ClientProxy.getClient(greeter);
            HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setUserName("BJ2");
            policy.setPassword("pswd");
            httpConduit.setAuthorization(policy);
           
View Full Code Here

        String wsdlUrl = null;
        wsdlUrl = wsdl.toURI().toString();

        //TODO test fault exceptions
        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]);
        //TODO: the following isn't a real test. We need to test against a service
        // that would actually notice the difference. At least it ensures that
        // specifying the property does not explode.
        Map<String, Object> jaxbContextProperties = new HashMap<String, Object>();
        jaxbContextProperties.put("com.sun.xml.bind.defaultNamespaceRemap", "uri:ultima:thule");
        dcf.setJaxbContextProperties(jaxbContextProperties);
        client = dcf.createClient(wsdlUrl, serviceName, portName);
        updateAddressPort(client, PORT);
        client.invoke("greetMe", "test");       
        result = client.invoke("sayHi");
        assertNotNull("no response received from service", result);
        assertEquals("Bonjour", result[0]);
    }
View Full Code Here

                        "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
        Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
                                                                   StreamSource.class,
                                                                   Service.Mode.PAYLOAD);

        Client client = ((DispatchImpl<StreamSource>)dispatcher).getClient();
        WSAddressingFeature wsAddressingFeature = new WSAddressingFeature();
        wsAddressingFeature.initialize(client, client.getBus());
        dispatcher.getRequestContext().put("org.apache.cxf.ws.addressing.replyto",
                                           "http://localhost:" + CLIENT_PORT
                                               + "/SoapContext/AsyncEchoClient");

        StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
View Full Code Here

        resp = port.addNumbers3Async(1, 2);
        try {
            resp.get();
        } catch (ExecutionException ex) {
            assertTrue("Found " + ex.getCause().getClass(), ex.getCause() instanceof IOException);
            Client c = ClientProxy.getClient(port);
            for (Interceptor<? extends Message> m : c.getOutInterceptors()) {
                if (m instanceof MAPCodec) {
                    assertTrue(((MAPCodec)m).getUncorrelatedExchanges().isEmpty());
                }
            }
        }
View Full Code Here

    @Test
    public void testDynamicClientExceptions() throws Exception {
        JaxWsDynamicClientFactory dcf =
            JaxWsDynamicClientFactory.newInstance();
        URL wsdlURL = new URL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl");
        Client client = dcf.createClient(wsdlURL);
        try {
            client.invoke("throwException", -2);
        } catch (Exception ex) {
            Object o = ex.getClass().getMethod("getFaultInfo").invoke(ex);
            assertNotNull(o);
        }
       
        try {
            client.getRequestContext().put("disable-fault-mapping", true);
            client.invoke("throwException", -2);
        } catch (SoapFault ex) {
            //expected
        }
      
    }
View Full Code Here

   
            if (dataBinding != null) {
                clientFactoryBean.setDataBinding(dataBinding);
            }
   
            Client c = clientFactoryBean.create();
            if (getInInterceptors() != null) {
                c.getInInterceptors().addAll(getInInterceptors());
            }
            if (getOutInterceptors() != null) {
                c.getOutInterceptors().addAll(getOutInterceptors());
            }
            if (getInFaultInterceptors() != null) {
                c.getInFaultInterceptors().addAll(getInFaultInterceptors());
            }
            if (getOutFaultInterceptors() != null) {
                c.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
            }
   
            ClientProxy handler = clientClientProxy(c);
   
            Class<?> classes[] = getImplementingClasses();
View Full Code Here

        if (getServiceFactory().getProperties() == null) {
            getServiceFactory().setProperties(properties);
        } else if (properties != null) {
            getServiceFactory().getProperties().putAll(properties);
        }
        Client client = null;
        Endpoint ep = null;
        try {
            ep = createEndpoint();
            applyProperties(ep);
            client = createClient(ep);
View Full Code Here

TOP

Related Classes of org.apache.cxf.endpoint.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.