Search in sources :

Example 56 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class EJBSignEncryptMultipleClientsTestCase method encryptedAndSignedRequestFromAlice.

@Test
public void encryptedAndSignedRequestFromAlice() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EJBEncryptSecurityService");
    URL wsdlURL = new URL(baseUrl, "/jaxws-wsse-sign-encrypt-mc/EJBEncryptSecurityService?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 57 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class EJBSignEncryptMultipleClientsTestCase 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", "EJBEncryptSecurityService");
    URL wsdlURL = new URL(baseUrl, "/jaxws-wsse-sign-encrypt-mc/EJBEncryptSecurityService?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)

Example 58 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class EJBSignEncryptMultipleClientsTestCase method encryptedAndSignedRequestFromJohn.

@Test
public void encryptedAndSignedRequestFromJohn() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "EJBEncryptSecurityService");
    URL wsdlURL = new URL(baseUrl, "/jaxws-wsse-sign-encrypt-mc/EJBEncryptSecurityService?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, "john");
    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 59 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class SignEncryptMultipleClientsTestCase method encryptedAndSignedRequestFromJohn.

@Test
public void encryptedAndSignedRequestFromJohn() 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, "john");
    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 60 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class WebServiceReferences method initServiceRef.

private static UnifiedServiceRefMetaData initServiceRef(final DeploymentUnit unit, final UnifiedServiceRefMetaData serviceRefUMDM, final String type, final WSRefAnnotationWrapper annotation) throws DeploymentUnitProcessingException {
    // wsdl location
    if (!isEmpty(annotation.wsdlLocation())) {
        serviceRefUMDM.setWsdlFile(annotation.wsdlLocation());
    }
    // ref class type
    final Module module = unit.getAttachment(Attachments.MODULE);
    final Class<?> typeClass = getClass(module, type);
    serviceRefUMDM.setServiceRefType(typeClass.getName());
    // ref service interface
    if (!isEmpty(annotation.value())) {
        serviceRefUMDM.setServiceInterface(annotation.value());
    } else if (Service.class.isAssignableFrom(typeClass)) {
        serviceRefUMDM.setServiceInterface(typeClass.getName());
    } else {
        serviceRefUMDM.setServiceInterface(Service.class.getName());
    }
    return serviceRefUMDM;
}
Also used : Service(javax.xml.ws.Service) Module(org.jboss.modules.Module)

Aggregations

Service (javax.xml.ws.Service)598 URL (java.net.URL)547 QName (javax.xml.namespace.QName)524 Bus (org.apache.cxf.Bus)399 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)384 DoubleItPortType (org.example.contract.doubleit.DoubleItPortType)361 Test (org.junit.Test)143 BindingProvider (javax.xml.ws.BindingProvider)63 Client (org.apache.cxf.endpoint.Client)43 HashMap (java.util.HashMap)36 SamlCallbackHandler (org.apache.cxf.systest.ws.saml.client.SamlCallbackHandler)31 STSClient (org.apache.cxf.ws.security.trust.STSClient)28 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)25 WebServiceException (javax.xml.ws.WebServiceException)20 WebService (javax.jws.WebService)18 IOException (java.io.IOException)16 File (java.io.File)15 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)15 Greeter (org.apache.hello_world_soap_http.Greeter)15 KeystorePasswordCallback (org.apache.cxf.systest.ws.common.KeystorePasswordCallback)14