Example usage for javax.xml.ws Binding setHandlerChain

List of usage examples for javax.xml.ws Binding setHandlerChain

Introduction

In this page you can find the example usage for javax.xml.ws Binding setHandlerChain.

Prototype

public void setHandlerChain(java.util.List<javax.xml.ws.handler.Handler> chain);

Source Link

Document

Sets the handler chain for the protocol binding instance.

Usage

From source file:be.e_contract.mycarenet.consent.ConsentClient.java

@SuppressWarnings("unchecked")
private void configureBindingProvider(BindingProvider bindingProvider, String location) {
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    @SuppressWarnings("rawtypes")
    List handlerChain = binding.getHandlerChain();
    handlerChain.add(this.wsSecuritySOAPHandler);
    binding.setHandlerChain(handlerChain);
}

From source file:be.fedict.eid.idp.sp.protocol.ws_federation.sts.SecurityTokenServiceClient.java

/**
 * Main constructor.//from  ww w . j a v a2s .c om
 * 
 * @param location
 *            the location of the STS service.
 */
public SecurityTokenServiceClient(String location) {
    SecurityTokenService securityTokenService = SecurityTokenServiceFactory.getInstance();

    this.port = securityTokenService.getSecurityTokenServicePort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new WSSecuritySoapHandler());
    handlerChain.add(new LoggingSoapHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.policyObjectFactory = new be.fedict.eid.idp.wstrust.jaxb.wspolicy.ObjectFactory();
    this.addrObjectFactory = new be.fedict.eid.idp.wstrust.jaxb.wsaddr.ObjectFactory();
    this.wsseObjectFactory = new be.fedict.eid.idp.wstrust.jaxb.wsse.ObjectFactory();
}

From source file:be.e_contract.mycarenet.certra.CertRAClient.java

public CertRAClient(String location) {
    CertRaService certRaService = CertRaServiceFactory.newInstance();
    this.port = certRaService.getCertRaPort();

    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new LoggingHandler());
    // LoggingHandler makes CXF fail on the attachments.
    // https://issues.apache.org/jira/browse/CXF-5496
    binding.setHandlerChain(handlerChain);

    this.protocolObjectFactory = new be.e_contract.mycarenet.certra.jaxb.protocol.ObjectFactory();
}

From source file:be.e_contract.mycarenet.ehbox.EHealthBoxPublicationClient.java

@SuppressWarnings("unchecked")
private void configureBindingProvider(BindingProvider bindingProvider, String location) {
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    @SuppressWarnings("rawtypes")
    List handlerChain = binding.getHandlerChain();
    handlerChain.add(this.wsSecuritySOAPHandler);
    handlerChain.add(new LoggingHandler());
    handlerChain.add(this.payloadLogicalHandler);
    binding.setHandlerChain(handlerChain);
}

From source file:be.e_contract.mycarenet.sts.EHealthSTSClient.java

/**
 * Main constructor./*from  ww  w. j  a  va  2s  .  com*/
 * 
 * @param location
 *            the URL of the eHealth STS web service.
 */
public EHealthSTSClient(String location) {
    EHealthSamlStsService service = EHealthSamlStsServiceFactory.newInstance();

    QName portQName = new QName("urn:be:ehealth:saml:sts:1.0", "EHealthSamlStsPort");
    this.dispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD);

    this.dispatch.getRequestContext().put(Dispatch.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = dispatch.getBinding();
    @SuppressWarnings("rawtypes")
    List<Handler> handlerChain = binding.getHandlerChain();
    this.wsSecuritySOAPHandler = new WSSecuritySOAPHandler();
    handlerChain.add(this.wsSecuritySOAPHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);
}

From source file:be.fedict.hsm.client.HSMProxyClient.java

/**
 * Main constructor. To access the HSM Proxy web service, you need to have a
 * valid credential.//from   w  ww  .ja  va2  s.  com
 * 
 * @param endpointAddress
 *            the HSM Proxy web service endpoint address.
 * @param credentialPrivateKey
 *            the credential private key.
 * @param credentialCertificate
 *            the corresponding credential X509 certificate.
 */
public HSMProxyClient(String endpointAddress, PrivateKey credentialPrivateKey,
        X509Certificate credentialCertificate) {
    this.endpointAddress = endpointAddress;

    DigitalSignatureService digitalSignatureService = DigitalSignatureServiceFactory.getInstance();
    this.dssPort = digitalSignatureService.getDigitalSignatureServicePort();

    BindingProvider bindingProvider = (BindingProvider) this.dssPort;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);

    this.dssObjectFactory = new ObjectFactory();
    this.dsObjectFactory = new be.fedict.hsm.ws.jaxb.xmldsig.ObjectFactory();
    this.hsmObjectFactory = new be.fedict.hsm.ws.jaxb.hsm.ObjectFactory();

    try {
        this.certificateFactory = CertificateFactory.getInstance("X.509");
    } catch (CertificateException e) {
        throw new RuntimeException("X509 certificate factory error: " + e.getMessage(), e);
    }

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new WSSecuritySOAPHandler(credentialPrivateKey, credentialCertificate));
    binding.setHandlerChain(handlerChain);
}

From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java

private DigitalSignatureServicePortType getPort() {
    DigitalSignatureService digitalSignatureService = DigitalSignatureServiceFactory.getInstance();
    DigitalSignatureServicePortType dssPort = digitalSignatureService.getDigitalSignatureServicePort();
    BindingProvider bindingProvider = (BindingProvider) dssPort;
    String location = this.baseURL.toString() + "dss";
    LOG.debug("location: " + location);
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new LoggingSOAPHandler());
    binding.setHandlerChain(handlerChain);

    return dssPort;
}

From source file:be.fedict.eid.idp.sp.protocol.saml2.artifact.ArtifactServiceClient.java

protected void registerSoapHandler(SOAPHandler soapHandler) {

    BindingProvider bindingProvider = (BindingProvider) this.port;

    Binding binding = bindingProvider.getBinding();
    @SuppressWarnings("unchecked")
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(soapHandler);//from  w ww . ja va 2s.c om
    binding.setHandlerChain(handlerChain);
}

From source file:be.e_contract.mycarenet.xkms.XKMSClient.java

/**
 * Main constructor./*from  w w  w .  j a v  a2s  .c o m*/
 * 
 * @param location
 *            the URL of the MyCareNet XKMS web service.
 */
public XKMSClient(String location) {
    XMLKeyManagementService service = XKMSServiceFactory.newInstance();
    this.port = service.getKeyServiceSoapPort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    @SuppressWarnings("rawtypes")
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.add(new LoggingHandler());
    this.proofOfPossessionSignatureSOAPHandler = new ProofOfPossessionSignatureSOAPHandler();
    handlerChain.add(this.proofOfPossessionSignatureSOAPHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.xmldsigObjectFactory = new be.e_contract.mycarenet.jaxb.xmldsig.ObjectFactory();
}

From source file:test.integ.be.fedict.hsm.ws.WebServiceSecurityTest.java

private void addSOAPHandler(SOAPHandler<SOAPMessageContext> soapHandler,
        DigitalSignatureServicePortType dssPort) {
    BindingProvider bindingProvider = (BindingProvider) dssPort;
    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    handlerChain.clear();//  w w  w.  ja v  a2 s.co  m
    handlerChain.add(soapHandler);
    handlerChain.add(new LoggingSOAPHandler());
    binding.setHandlerChain(handlerChain);
}