Example usage for javax.xml.ws Binding getHandlerChain

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

Introduction

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

Prototype

public java.util.List<javax.xml.ws.handler.Handler> getHandlerChain();

Source Link

Document

Gets a copy of the handler chain for a 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  w  w w  .ja v a 2 s.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.xkms.XKMSClient.java

/**
 * Main constructor.//from  w ww .  j  a v  a2s  . co 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:be.e_contract.mycarenet.sts.EHealthSTSClient.java

/**
 * Main constructor.//  ww w  .  j  a v  a  2s.co  m
 * 
 * @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.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.agiv.security.client.RSTSClient.java

/**
 * Main constructor.//from w w w.  ja  v a  2  s.  c o m
 * 
 * @param location
 *            the location of the R-STS WS-Trust web service.
 */
public RSTSClient(String location) {
    this.location = location;
    SecurityTokenService_Service service = SecurityTokenServiceFactory.getInstance();
    this.port = service.getSecurityTokenServicePort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    this.wsTrustHandler = new WSTrustHandler();
    handlerChain.add(this.wsTrustHandler);
    this.wsAddressingHandler = new WSAddressingHandler();
    handlerChain.add(this.wsAddressingHandler);
    this.wsSecurityHandler = new WSSecurityHandler();
    handlerChain.add(this.wsSecurityHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.policyObjectFactory = new be.agiv.security.jaxb.wspolicy.ObjectFactory();
    this.addrObjectFactory = new be.agiv.security.jaxb.wsaddr.ObjectFactory();

}

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 w w  . j a  va  2  s. co m
 * 
 * @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:be.agiv.security.client.SecureConversationClient.java

/**
 * Main constructor. The given location is the same as where the actual
 * business web service is running.//from ww  w  . j  a  v a2 s  . co  m
 * 
 * @param location
 *            the location of the WS-SecureConversation enabled web service.
 */
public SecureConversationClient(String location) {
    this.location = location;
    SecurityTokenService_Service service = SecurityTokenServiceFactory.getInstance();
    this.port = service.getSecurityTokenServicePort();
    BindingProvider bindingProvider = (BindingProvider) this.port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);

    Binding binding = bindingProvider.getBinding();
    List<Handler> handlerChain = binding.getHandlerChain();
    this.wsTrustHandler = new WSTrustHandler();
    handlerChain.add(this.wsTrustHandler);
    this.wsAddressingHandler = new WSAddressingHandler();
    handlerChain.add(this.wsAddressingHandler);
    this.wsSecurityHandler = new WSSecurityHandler();
    handlerChain.add(this.wsSecurityHandler);
    handlerChain.add(new LoggingHandler());
    binding.setHandlerChain(handlerChain);

    this.objectFactory = new ObjectFactory();
    this.wssObjectFactory = new be.agiv.security.jaxb.wsse.ObjectFactory();

    this.secureRandom = new SecureRandom();
    this.secureRandom.setSeed(System.currentTimeMillis());
}

From source file:be.e_contract.mycarenet.ehbox.EHealthBoxConsultationClient.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(this.inboundAttachmentsSOAPHandler);
    // handlerChain.add(new LoggingHandler());
    // LoggingHandler makes CXF fail on the attachments.
    // https://issues.apache.org/jira/browse/CXF-5496
    binding.setHandlerChain(handlerChain);
}