Search in sources :

Example 1 with PingService11

use of wssec.wssec11.PingService11 in project cxf by apache.

the class WSSecurity11Common method runClientServer.

public void runClientServer(String portPrefix, String portNumber, boolean unrestrictedPoliciesInstalled, boolean streaming) throws IOException {
    Bus bus = null;
    if (unrestrictedPoliciesInstalled) {
        bus = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/wssec11/client.xml");
    } else {
        bus = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/wssec11/client_restricted.xml");
    }
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdlLocation = null;
    PingService11 svc = null;
    wsdlLocation = getWsdlLocation(portPrefix, portNumber);
    svc = new PingService11(wsdlLocation);
    final IPingService port = svc.getPort(new QName("http://WSSec/wssec11", portPrefix + "_IPingService"), IPingService.class);
    if (streaming) {
        ((BindingProvider) port).getRequestContext().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true");
        ((BindingProvider) port).getResponseContext().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true");
    }
    final String output = port.echo(INPUT);
    assertEquals(INPUT, output);
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) IPingService(wssec.wssec11.IPingService) QName(javax.xml.namespace.QName) PingService11(wssec.wssec11.PingService11) URL(java.net.URL)

Aggregations

URL (java.net.URL)1 QName (javax.xml.namespace.QName)1 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 IPingService (wssec.wssec11.IPingService)1 PingService11 (wssec.wssec11.PingService11)1