Package javax.xml.ws

Examples of javax.xml.ws.BindingProvider


            // expected
        }

       
       
        BindingProvider bp = (BindingProvider)greeter;
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                   realAddress);
        greeter.greetMe("test");

        //should persist
        greeter.greetMe("test");

        bp.getRequestContext().remove(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
       
        try {
            greeter.greetMe("test");
            fail("Should fail");
        } catch (WebServiceException f) {
            // expected
        }

        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                   realAddress);
        String reply = greeter.sayHi();
        assertNotNull("no response received from service", reply);
        assertEquals("Bonjour", reply);
                                  
View Full Code Here


            "ws-security.username", "alice"
        );
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)port;
        clearSTSClient(p);
       
        // This invocation should be successful as the token is cached
        doubleIt(port, 25);
       
        ((java.io.Closeable)port).close();
        //
        // Proxy no. 2
        //
        DoubleItPortType port2 =
            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(port2, PORT);
       
        TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
       
        // Change the STSClient so that it can no longer find the STS
        p = (BindingProvider)port2;
        clearSTSClient(p);
       
        // This should fail as the cache is not being used
        try {
            doubleIt(port2, 40);
            fail("Failure expected as the token is not stored in the cache");
        } catch (Exception ex) {
            // expected
        }
       
        // Set the cache correctly
        p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
       
        // Make another invocation - this should succeed as the token is cached
        p.getRequestContext().put("ws-security.username", "alice");
        doubleIt(port2, 40);
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        p.getRequestContext().put(SecurityConstants.TOKEN, new SecurityToken());
        try {
            doubleIt(port2, 40);
            fail("Failure expected as the cache is reset");
        } catch (Exception ex) {
            // expected
View Full Code Here

        } catch (Exception ex) {
            //
        }
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)port;
        clearSTSClient(p);
       
        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        doubleIt(port, 25);
       
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "bob"
        );
        doubleIt(port, 30);
       
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "eve2"
        );
        try {
            doubleIt(port, 30);
            fail("Failure expected on a bad user");
        } catch (Exception ex) {
            //
        }
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        try {
            doubleIt(port, 30);
View Full Code Here

       
        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        BindingProvider p = (BindingProvider)port;
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(port, 25);
       
        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        clearSTSClient(p);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(port, 25);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(port, 25);
       
        // Change appliesTo - should fail
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        try {
            doubleIt(port, 30);
View Full Code Here

        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        // Disable appliesTo
        BindingProvider p = (BindingProvider)port;
        STSClient stsClient = (STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
        stsClient.setEnableAppliesTo(false);
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        clearSTSClient(p);
View Full Code Here

        if (test.isStreaming()) {
            SecurityTestUtil.enableStreaming(asymmetricSaml1EncryptedPort);
        }
       
        // Set the X509Certificate manually on the STSClient (just to test that we can)
        BindingProvider bindingProvider = (BindingProvider)asymmetricSaml1EncryptedPort;
        STSClient stsClient =
            (STSClient)bindingProvider.getRequestContext().get(SecurityConstants.STS_CLIENT);
        Crypto crypto = CryptoFactory.getInstance("clientKeystore.properties");
        CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
        cryptoType.setAlias("myclientkey");
        X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
        stsClient.setUseKeyCertificate(certs[0]);
View Full Code Here

            "ws-security.username", "alice"
        );
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)port;
        clearSTSClient(p);
       
        // This invocation should be successful as the token is cached
        doubleIt(port, 25);
       
        //
        // Proxy no. 2
        //
        DoubleItPortType port2 =
            service.getPort(portQName, DoubleItPortType.class);
        updateAddressPort(port2, PORT);
       
        TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
       
        // Change the STSClient so that it can no longer find the STS
        p = (BindingProvider)port2;
        clearSTSClient(p);
       
        // This should fail as the cache is not being used
        try {
            doubleIt(port2, 40);
            fail("Failure expected as the token is not stored in the cache");
        } catch (Exception ex) {
            // expected
        }
       
        // Set the cache correctly
        p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
       
        // Make another invocation - this should succeed as the token is cached
        p.getRequestContext().put("ws-security.username", "alice");
        doubleIt(port2, 40);
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        p.getRequestContext().put(SecurityConstants.TOKEN, new SecurityToken());
        try {
            doubleIt(port2, 40);
            fail("Failure expected as the cache is reset");
        } catch (Exception ex) {
            // expected
View Full Code Here

        } catch (Exception ex) {
            //
        }
       
        // Change the STSClient so that it can no longer find the STS
        BindingProvider p = (BindingProvider)port;
        clearSTSClient(p);
       
        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        doubleIt(port, 25);
       
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "bob"
        );
        doubleIt(port, 30);
       
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "eve2"
        );
        try {
            doubleIt(port, 30);
            fail("Failure expected on a bad user");
        } catch (Exception ex) {
            //
        }
       
        // Reset the cache - this invocation should fail
        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        try {
            doubleIt(port, 30);
View Full Code Here

       
        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        BindingProvider p = (BindingProvider)port;
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(port, 25);
       
        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        clearSTSClient(p);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
        );
        doubleIt(port, 25);
       
        // Make a successful invocation - should work as token is cached
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "bob"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        doubleIt(port, 25);
       
        // Change appliesTo - should fail
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        p.getRequestContext().put(
            SecurityConstants.STS_APPLIES_TO,
            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
        );
        try {
            doubleIt(port, 30);
View Full Code Here

        // Make a successful invocation
        ((BindingProvider)port).getRequestContext().put(
            "ws-security.username", "alice"
        );
        // Disable appliesTo
        BindingProvider p = (BindingProvider)port;
        STSClient stsClient = (STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
        stsClient.setEnableAppliesTo(false);
        doubleIt(port, 25);
       
        // Change the STSClient so that it can no longer find the STS
        clearSTSClient(p);
View Full Code Here

TOP

Related Classes of javax.xml.ws.BindingProvider

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.