Package org.apache.cxf.endpoint

Examples of org.apache.cxf.endpoint.Client


    @Test
    public void testInvalidRM11WSA200408() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
       
        // WS-RM 1.1, but using the WS-A 1.0 namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM11Constants.NAMESPACE_URI);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME);

        try {
            greeter.greetMe("one");
            fail("invalid namespace combination accepted");
        } catch (Exception e) {
View Full Code Here


    @Test
    public void testInvalidRM11WSA200408OnReceive() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
       
        // WS-RM 1.0 using the WS-A 1.0 namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM10Constants.NAMESPACE_URI);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME);

        // rewrite the outgoing message's WS-RM namespace to 1.1
        TransformOutInterceptor trans = new TransformOutInterceptor();
        Map<String, String> outElements = new HashMap<String, String>();
        outElements.put("{" + RM10Constants.NAMESPACE_URI + "}*", "{" + RM11Constants.NAMESPACE_URI + "}*");
        trans.setOutTransformElements(outElements);
       
        client.getOutInterceptors().add(trans);
        try {
            greeter.greetMe("one");
            fail("invalid namespace combination accepted");
        } catch (Exception e) {
            assertTrue(e.getCause() instanceof SoapFault);
View Full Code Here

    @Test
    public void testInvalidWSAOnReceive() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
       
        // WS-RM 1.0 using the WS-A 1.0 namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM10Constants.NAMESPACE_URI);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME);

        // rewrite the outgoing message's WS-A namespace to an invalid one
        TransformOutInterceptor trans = new TransformOutInterceptor();
        Map<String, String> outElements = new HashMap<String, String>();
        outElements.put("{" + Names200408.WSA_NAMESPACE_NAME + "}*", "{http://cxf.apache.org/invalid}*");
        trans.setOutTransformElements(outElements);
       
        client.getOutInterceptors().add(trans);
        try {
            greeter.greetMe("one");
            fail("invalid wsa header accepted");
        } catch (Exception e) {
            assertTrue(e.getCause() instanceof SoapFault);
View Full Code Here

    @Test
    public void testInvalidWSRMMustUnderstandOnReceive() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
       
        // WS-RM 1.0 using the WS-A 1.0 namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM10Constants.NAMESPACE_URI);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME);

        // rewrite the outgoing message's WS-RM namespace to an invalid one
        TransformOutInterceptor trans = new TransformOutInterceptor();
        Map<String, String> outElements = new HashMap<String, String>();
        outElements.put("{" + RM10Constants.NAMESPACE_URI + "}*", "{http://cxf.apache.org/invalid}*");
        trans.setOutTransformElements(outElements);
       
        client.getOutInterceptors().add(trans);
        try {
            greeter.greetMe("one");
            fail("invalid wsrm header");
        } catch (Exception e) {
            assertTrue(e.getCause() instanceof SoapFault);
View Full Code Here

    @Test
    public void testInvalidWSRMOnReceive() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
       
        // WS-RM 1.0 using the WS-A 1.0 namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM10Constants.NAMESPACE_URI);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME);

        // remove the outgoing message's WS-RM header
        TransformOutInterceptor trans = new TransformOutInterceptor();
        Map<String, String> outElements = new HashMap<String, String>();
        outElements.put("{" + RM10Constants.NAMESPACE_URI + "}Sequence", "");
        trans.setOutTransformElements(outElements);
       
        client.getOutInterceptors().add(trans);
        try {
            greeter.greetMe("one");
            fail("invalid wsrm header");
        } catch (Exception e) {
            assertTrue(e.getCause() instanceof SoapFault);
View Full Code Here

    @Test
    public void testRM10WSA200408Decoupled() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
       
        // same as default, but explicitly setting the WS-Addressing namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME);

        assertEquals("ONE", greeter.greetMe("one"));
        assertEquals("TWO", greeter.greetMe("two"));
        assertEquals("THREE", greeter.greetMe("three"));
View Full Code Here

    @Test
    public void testRM10WSA15Decoupled() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
       
        // WS-RM 1.0, but using the WS-A 1.0 namespace
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names.WSA_NAMESPACE_NAME);

        assertEquals("ONE", greeter.greetMe("one"));
        assertEquals("TWO", greeter.greetMe("two"));
        assertEquals("THREE", greeter.greetMe("three"));
View Full Code Here

    @Test
    public void testRM11Decoupled() throws Exception {
        init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", true);
       
        // WS-RM 1.1 and WS-A 1.0
        Client client = ClientProxy.getClient(greeter);
        client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM11Constants.NAMESPACE_URI);
        client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names.WSA_NAMESPACE_NAME);

        assertEquals("ONE", greeter.greetMe("one"));
        assertEquals("TWO", greeter.greetMe("two"));
        assertEquals("THREE", greeter.greetMe("three"));
View Full Code Here

        final javax.xml.ws.Service svc
            = javax.xml.ws.Service.create(WSDL_LOC, GREETER_SERVICE_QNAME);
        final Greeter greeter = svc.getPort(USERNAME_TOKEN_PORT_QNAME, Greeter.class);
        updateAddressPort(greeter, PORT);
       
        Client client = ClientProxy.getClient(greeter);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("action", "UsernameToken");
        props.put("user", "alice");
        props.put("passwordType", "PasswordText");
        WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor(props);
       
        client.getOutInterceptors().add(wss4jOut);

        ((BindingProvider)greeter).getRequestContext().put("password", "password");
       
        try {
            greeter.greetMe("CXF");
View Full Code Here

            new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/policy/client/javafirstclient.xml");
       
        JavaFirstAttachmentPolicyService svc =
            (JavaFirstAttachmentPolicyService) ctx.getBean("JavaFirstAttachmentPolicyServiceClient");
       
        Client client = ClientProxy.getClient(svc);
        client.getEndpoint().getEndpointInfo().setAddress(
                                "http://localhost:" + PORT + "/JavaFirstAttachmentPolicyService");
      
        WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor();
        client.getEndpoint().getOutInterceptors().add(wssOut);
       
        // just some basic sanity tests first to make sure that auth is working where password is provided.
        wssOut.setProperties(getPasswordProperties("alice", "password"));
        svc.doInputMessagePolicy();
       
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.