Search in sources :

Example 11 with ServiceIface

use of org.jboss.as.test.integration.ws.wsse.ServiceIface in project wildfly by wildfly.

the class SignEncryptTestCase method encryptedAndSignedRequest.

@Test
public void encryptedAndSignedRequest() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EncryptSecurityService");
    URL wsdlURL = new URL(baseUrl.toString() + "EncryptSecurityService?wsdl");
    // use a new bus to avoid any possible clash with other tests
    Service service = Service.create(wsdlURL, serviceName, new UseNewBusFeature());
    ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
    setupWsse(proxy);
    Assert.assertEquals("Secure Hello World!", proxy.sayHello());
}
Also used : ServiceIface(org.jboss.as.test.integration.ws.wsse.ServiceIface) QName(javax.xml.namespace.QName) UseNewBusFeature(org.jboss.wsf.stack.cxf.client.UseNewBusFeature) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Example 12 with ServiceIface

use of org.jboss.as.test.integration.ws.wsse.ServiceIface in project wildfly by wildfly.

the class SignEncryptMultipleClientsTestCase method encryptedAndSignedRequestFromAlice.

@Test
public void encryptedAndSignedRequestFromAlice() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EncryptSecurityService");
    URL wsdlURL = new URL(baseUrl.toString() + "EncryptSecurityService?wsdl");
    // use a new bus to avoid any possible clash with other tests
    Service service = Service.create(wsdlURL, serviceName, new UseNewBusFeature());
    ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
    setupWsse(proxy, "alice");
    Assert.assertEquals("Secure Hello World!", proxy.sayHello());
}
Also used : ServiceIface(org.jboss.as.test.integration.ws.wsse.ServiceIface) QName(javax.xml.namespace.QName) UseNewBusFeature(org.jboss.wsf.stack.cxf.client.UseNewBusFeature) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Example 13 with ServiceIface

use of org.jboss.as.test.integration.ws.wsse.ServiceIface in project wildfly by wildfly.

the class SignEncryptMultipleClientsTestCase method encryptedAndSignedRequestFromUntrustedMax.

/*
     * Max's public key is not trusted in Bob's keystore
     * Max's keystore contain's Bob's public key as trusted.
     */
@Test
public void encryptedAndSignedRequestFromUntrustedMax() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EncryptSecurityService");
    URL wsdlURL = new URL(baseUrl.toString() + "EncryptSecurityService?wsdl");
    // use a new bus to avoid any possible clash with other tests
    Service service = Service.create(wsdlURL, serviceName, new UseNewBusFeature());
    ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
    setupWsse(proxy, "max");
    try {
        proxy.sayHello();
        Assert.fail("Max shouldn't invoke this service");
    } catch (SOAPFaultException ex) {
    // expected failure because max isn't trusted
    }
}
Also used : ServiceIface(org.jboss.as.test.integration.ws.wsse.ServiceIface) QName(javax.xml.namespace.QName) UseNewBusFeature(org.jboss.wsf.stack.cxf.client.UseNewBusFeature) Service(javax.xml.ws.Service) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)13 QName (javax.xml.namespace.QName)13 Service (javax.xml.ws.Service)13 ServiceIface (org.jboss.as.test.integration.ws.wsse.ServiceIface)13 Test (org.junit.Test)13 UseNewBusFeature (org.jboss.wsf.stack.cxf.client.UseNewBusFeature)8 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)4