Search in sources :

Example 1 with PingService

use of wssec.wssec10.PingService in project cxf by apache.

the class WSSecurity10Test method testClientServer.

@Test
public void testClientServer() {
    BusFactory.setDefaultBus(getStaticBus());
    BusFactory.setThreadDefaultBus(getStaticBus());
    URL wsdlLocation = null;
    PingService svc = null;
    wsdlLocation = getWsdlLocation(test.prefix, test.port);
    svc = new PingService(wsdlLocation);
    final IPingService port = svc.getPort(new QName("http://WSSec/wssec10", test.prefix + "_IPingService"), IPingService.class);
    Client cl = ClientProxy.getClient(port);
    if (test.streaming) {
        // Streaming
        ((BindingProvider) port).getRequestContext().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true");
        ((BindingProvider) port).getResponseContext().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true");
    }
    HTTPConduit http = (HTTPConduit) cl.getConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(0);
    httpClientPolicy.setReceiveTimeout(0);
    http.setClient(httpClientPolicy);
    String output = port.echo(INPUT);
    assertEquals(INPUT, output);
    cl.destroy();
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) IPingService(wssec.wssec10.IPingService) QName(javax.xml.namespace.QName) IPingService(wssec.wssec10.IPingService) PingService(wssec.wssec10.PingService) HTTPClientPolicy(org.apache.cxf.transports.http.configuration.HTTPClientPolicy) Client(org.apache.cxf.endpoint.Client) URL(java.net.URL) Test(org.junit.Test)

Example 2 with PingService

use of wssec.wssec10.PingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationLegacyTest method getComplexPolicyPort.

private static IPingService getComplexPolicyPort(Bus bus) {
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    PingService svc = new PingService(getWsdlLocation("UserNameOverTransport"));
    return svc.getPort(new QName("http://WSSec/wssec10", "UserNameOverTransport" + "_IPingService"), IPingService.class);
}
Also used : QName(javax.xml.namespace.QName) IPingService(wssec.wssec10.IPingService) PingService(wssec.wssec10.PingService)

Example 3 with PingService

use of wssec.wssec10.PingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationTest method getUTOnlyPort.

private static IPingService getUTOnlyPort(Bus bus, boolean hashed) {
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    PingService svc = new PingService(getWsdlLocation(hashed));
    return svc.getPort(new QName("http://WSSec/wssec10", hashed ? "UserName_IPingService_hashed" : "UserName_IPingService"), IPingService.class);
}
Also used : QName(javax.xml.namespace.QName) IPingService(wssec.wssec10.IPingService) PingService(wssec.wssec10.PingService)

Example 4 with PingService

use of wssec.wssec10.PingService in project cxf by apache.

the class WSSecurity10UsernameAuthorizationTest method getComplexPolicyPort.

private static IPingService getComplexPolicyPort(Bus bus) {
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    PingService svc = new PingService(getWsdlLocation("UserNameOverTransport"));
    return svc.getPort(new QName("http://WSSec/wssec10", "UserNameOverTransport" + "_IPingService"), IPingService.class);
}
Also used : QName(javax.xml.namespace.QName) IPingService(wssec.wssec10.IPingService) PingService(wssec.wssec10.PingService)

Aggregations

QName (javax.xml.namespace.QName)4 IPingService (wssec.wssec10.IPingService)4 PingService (wssec.wssec10.PingService)4 URL (java.net.URL)1 Client (org.apache.cxf.endpoint.Client)1 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)1 HTTPClientPolicy (org.apache.cxf.transports.http.configuration.HTTPClientPolicy)1 Test (org.junit.Test)1