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 camel by apache.
the class CXFWsdlOnlyPayloadModeNoSpringTest method testRoutes.
@Test
public void testRoutes() throws Exception {
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, QName.valueOf(getServiceName()));
Person client = ss.getSoap();
Client c = ClientProxy.getClient(client);
((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/" + getClass().getSimpleName() + "/PersonService");
c.getInInterceptors().add(new LoggingInInterceptor());
c.getOutInterceptors().add(new LoggingOutInterceptor());
Holder<String> personId = new Holder<String>();
personId.value = "hello";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
client.getPerson(personId, ssn, name);
assertEquals("Bonjour", name.value);
}
use of org.apache.cxf.interceptor.LoggingInInterceptor in project camel by apache.
the class CxfConsumerPayloadFaultCauseEnabledTest method testInvokingFromCxfClient.
@Test
public void testInvokingFromCxfClient() throws Exception {
this.getCamelContextService();
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, SERVICE_QNAME);
Person client = ss.getSoap();
Client c = ClientProxy.getClient(client);
c.getInInterceptors().add(new LoggingInInterceptor());
c.getOutInterceptors().add(new LoggingOutInterceptor());
((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceAddress);
Holder<String> personId = new Holder<String>();
personId.value = "";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
try {
client.getPerson(personId, ssn, name);
fail("SOAPFault expected!");
} catch (Exception e) {
assertTrue(e instanceof SOAPFaultException);
SOAPFault fault = ((SOAPFaultException) e).getFault();
assertEquals("Someone messed up the service. Caused by: Homer", fault.getFaultString());
}
}
Aggregations