Search in sources :

Example 86 with Service

use of javax.xml.ws.Service in project cxf by apache.

the class STSSenderVouchesTest method testSAML2SenderVouches.

@org.junit.Test
public void testSAML2SenderVouches() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = STSSenderVouchesTest.class.getResource("cxf-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = STSSenderVouchesTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2Port");
    DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());
    TokenTestUtils.updateSTSPort((BindingProvider) port, test.getStsPort());
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(port);
    }
    doubleIt(port, 25);
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 87 with Service

use of javax.xml.ws.Service in project cxf by apache.

the class TransformationTest method testTokenTransformationClaims.

@org.junit.Test
public void testTokenTransformationClaims() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = TransformationTest.class.getResource("cxf-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = TransformationTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportUTClaimsPort");
    DoubleItPortType transportUTPort = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(transportUTPort, PORT);
    doubleIt(transportUTPort, 25);
    ((java.io.Closeable) transportUTPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 88 with Service

use of javax.xml.ws.Service in project cxf by apache.

the class TransformationTest method testTokenTransformation.

@org.junit.Test
public void testTokenTransformation() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = TransformationTest.class.getResource("cxf-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = TransformationTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportUTPort");
    DoubleItPortType transportUTPort = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(transportUTPort, PORT);
    doubleIt(transportUTPort, 25);
    ((java.io.Closeable) transportUTPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 89 with Service

use of javax.xml.ws.Service in project cxf by apache.

the class UsernameTokenTest method testUsernameTokenAuthorization.

@org.junit.Test
public void testUsernameTokenAuthorization() throws Exception {
    // Token transformation is not supported for the streaming code
    if (STAX_PORT.equals(test.getPort())) {
        return;
    }
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = UsernameTokenTest.class.getResource("cxf-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = UsernameTokenTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItTransportUTAuthorizationPort");
    DoubleItPortType transportUTPort = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(transportUTPort, test.getPort());
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(transportUTPort);
    }
    doubleIt(transportUTPort, 25);
    ((java.io.Closeable) transportUTPort).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

Example 90 with Service

use of javax.xml.ws.Service in project cxf by apache.

the class AsymmetricBindingTest method testUsernameTokenSAML2KeyValue.

@org.junit.Test
public void testUsernameTokenSAML2KeyValue() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = AsymmetricBindingTest.class.getResource("cxf-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = AsymmetricBindingTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2KeyValuePort");
    DoubleItPortType asymmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(asymmetricSaml2Port, test.getPort());
    TokenTestUtils.updateSTSPort((BindingProvider) asymmetricSaml2Port, test.getStsPort());
    if (test.isStreaming()) {
        SecurityTestUtil.enableStreaming(asymmetricSaml2Port);
    }
    doubleIt(asymmetricSaml2Port, 30);
    TokenTestUtils.verifyToken(asymmetricSaml2Port);
    ((java.io.Closeable) asymmetricSaml2Port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) URL(java.net.URL)

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