use of org.apache.cxf.interceptor.LoggingInInterceptor in project qi4j-sdk by Qi4j.
the class HelloClient method main.
public static void main(String[] args) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(HelloWorld.class);
factory.setAddress("http://localhost:9001/helloWorld");
HelloWorld client = (HelloWorld) factory.create();
String reply = client.sayHi("World");
System.out.println("Server said: " + reply);
}
use of org.apache.cxf.interceptor.LoggingInInterceptor in project midpoint by Evolveum.
the class Action method createModelPort.
protected ModelPortType createModelPort() {
ModelService modelService = new ModelService();
ModelPortType port = modelService.getModelPort();
BindingProvider bp = (BindingProvider) port;
Client client = ClientProxy.getClient(port);
Endpoint endpoint = client.getEndpoint();
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = http.getClient();
if (httpClientPolicy == null) {
httpClientPolicy = new HTTPClientPolicy();
http.setClient(httpClientPolicy);
}
httpClientPolicy.setConnectionTimeout(10000);
Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, params.getUrl().toString());
requestContext.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
requestContext.put(WSHandlerConstants.USER, params.getUsername());
requestContext.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
ClientPasswordHandler handler = new ClientPasswordHandler();
handler.setPassword(params.getInsertedPassword());
requestContext.put(WSHandlerConstants.PW_CALLBACK_REF, handler);
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(requestContext);
endpoint.getOutInterceptors().add(wssOut);
if (params.isVerbose()) {
endpoint.getOutInterceptors().add(new LoggingOutInterceptor());
endpoint.getInInterceptors().add(new LoggingInInterceptor());
}
return port;
}
use of org.apache.cxf.interceptor.LoggingInInterceptor in project OpenAM by OpenRock.
the class SoapSTSConsumer method getSTSClient.
private STSClient getSTSClient(String wsdlAddress, QName serviceQName, QName portQName) throws SoapSTSConsumerException {
STSClient stsClient = new STSClient(bus);
if (logMessages) {
stsClient.getInInterceptors().add(new LoggingInInterceptor());
stsClient.getOutInterceptors().add(new LoggingOutInterceptor());
}
stsClient.setWsdlLocation(wsdlAddress);
stsClient.setServiceName(serviceQName.toString());
stsClient.setEndpointName(portQName.toString());
Map<String, Object> properties = new HashMap<>();
properties.put(SecurityConstants.USERNAME, usernameTokenSupportingTokenUsername);
properties.put(SecurityConstants.CALLBACK_HANDLER, callbackHander);
/*
In a asymmetric binding, the client encrypt messages with with the sts' public key.
Note that this trust (Public Key) keystore entry is not protected by a password, so the SoapSTSConsumerCallbackHandler is
not asked to provide the password corresponding to this entry.
*/
properties.put(SecurityConstants.ENCRYPT_USERNAME, stsPublicKeyAlias);
Crypto crypto;
try {
crypto = CryptoFactory.getInstance(getEncryptionProperties());
} catch (WSSecurityException e) {
throw new SoapSTSConsumerException(e.getMessage(), e);
}
/*
if the requested key is Public the STS_TOKEN_CRYPTO is used by the STSClient 'to send/process any
RSA/DSAKeyValue tokens' - from javadocs
*/
properties.put(SecurityConstants.STS_TOKEN_CRYPTO, crypto);
properties.put(SecurityConstants.ENCRYPT_CRYPTO, crypto);
properties.put(SecurityConstants.SIGNATURE_CRYPTO, crypto);
stsClient.setProperties(properties);
return stsClient;
}
use of org.apache.cxf.interceptor.LoggingInInterceptor in project Activiti by Activiti.
the class AbstractWebServiceTaskTest method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
webServiceMock = new WebServiceMockImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(WebServiceMock.class);
svrFactory.setAddress("http://localhost:63081/webservicemock");
svrFactory.setServiceBean(webServiceMock);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
use of org.apache.cxf.interceptor.LoggingInInterceptor in project midpoint by Evolveum.
the class Main method createModelPort.
public static ModelPortType createModelPort(String[] args) {
String endpointUrl = DEFAULT_ENDPOINT_URL;
if (args.length > 0) {
endpointUrl = args[0];
}
System.out.println("Endpoint URL: " + endpointUrl);
// uncomment this if you want to use Fiddler or any other proxy
//ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888));
ModelService modelService = new ModelService();
ModelPortType modelPort = modelService.getModelPort();
BindingProvider bp = (BindingProvider) modelPort;
Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, ADM_USERNAME);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
// enable the following to get client-side logging of outgoing requests and incoming responses
cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
return modelPort;
}
Aggregations