List of usage examples for javax.xml.ws BindingProvider getBinding
Binding getBinding();
From source file:be.agiv.security.client.RSTSClient.java
/** * Main constructor.//w w w .j a v a 2 s . com * * @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.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 w w.j a v a 2 s . c o m*/ binding.setHandlerChain(handlerChain); }
From source file:be.fedict.eid.idp.sp.protocol.saml2.artifact.ArtifactServiceClient.java
protected void removeSoapHandler(Class<? extends SOAPHandler> soapHandlerClass) { BindingProvider bindingProvider = (BindingProvider) this.port; Binding binding = bindingProvider.getBinding(); @SuppressWarnings("unchecked") List<Handler> handlerChain = binding.getHandlerChain(); Iterator<Handler> iter = handlerChain.iterator(); while (iter.hasNext()) { Handler handler = iter.next(); if (handler.getClass().isAssignableFrom(soapHandlerClass)) { iter.remove();/* w w w . j a v a2 s. c o m*/ } } }
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();/*from w w w . j a v a 2 s .com*/ handlerChain.add(soapHandler); handlerChain.add(new LoggingSOAPHandler()); binding.setHandlerChain(handlerChain); }
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); }
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.// w w w. j a va2 s . c om * * @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.xkms2.XKMS2Client.java
/** * Main constructor.//from w ww.j a v a 2s . c om * * @param location * the URL of the MyCareNet XKMS 2.0 web service. */ public XKMS2Client(String location) { XMLKeyManagementService service = XKMS2ServiceFactory.newInstance(); this.keyServicePort = service.getKeyServiceSoapPort(); BindingProvider bindingProvider = (BindingProvider) this.keyServicePort; bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location); Binding binding = bindingProvider.getBinding(); @SuppressWarnings("rawtypes") List<Handler> handlerChain = binding.getHandlerChain(); this.proofOfPossessionSignatureSOAPHandler = new ProofOfPossessionSignatureSOAPHandler(); handlerChain.add(new LoggingHandler()); handlerChain.add(this.proofOfPossessionSignatureSOAPHandler); this.keyBindingAuthenticationSignatureSOAPHandler = new KeyBindingAuthenticationSignatureSOAPHandler(); handlerChain.add(this.keyBindingAuthenticationSignatureSOAPHandler); handlerChain.add(new LoggingHandler()); binding.setHandlerChain(handlerChain); this.objectFactory = new ObjectFactory(); this.xmldsigObjectFactory = new be.e_contract.mycarenet.jaxb.xmldsig.ObjectFactory(); try { this.datatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new RuntimeException("DatatypeFactory error: " + e.getMessage(), e); } }
From source file:be.agiv.security.client.IPSTSClient.java
/** * Main constructor.//from w w w .j a va 2 s . c o m * * @param location * the location of the IP-STS WS-Trust web service. * @param realm * the AGIV R-STS realm. * @param secondaryParametersNodeList * the DOM node list that will be used as SecondaryParameters for * RST requests. */ public IPSTSClient(String location, String realm, NodeList secondaryParametersNodeList) { this.location = location; this.realm = realm; Provider jaxwsProvider = Provider.provider(); LOG.debug("JAX-WS provider: " + jaxwsProvider.getClass().getName()); 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(); this.wsTrustHandler.setSecondaryParameters(secondaryParametersNodeList); 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(); this.wssObjectFactory = new be.agiv.security.jaxb.wsse.ObjectFactory(); this.secureRandom = new SecureRandom(); this.secureRandom.setSeed(System.currentTimeMillis()); }
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:at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.SignedDocAttributeRequestProvider.java
/** * Get mime type of document from DTL// w w w . j av a 2s . c o m * @param docId The document id * @param dtlUrl The url of dtl * @return The mime type */ private String getDocumentMimeFromDtl(String docId, String eDtlUrl) throws Exception { URL url = null; try { url = new URL(dtlUrl); QName qname = new QName("http://stork.eu", "DocumentService"); Service service = Service.create(url, qname); DocumentService docservice = service.getPort(DocumentService.class); BindingProvider bp = (BindingProvider) docservice; SOAPBinding binding = (SOAPBinding) bp.getBinding(); binding.setMTOMEnabled(true); if (eDtlUrl.equalsIgnoreCase(dtlUrl)) return docservice.getDocumentMime(docId, ""); else return docservice.getDocumentMime(docId, eDtlUrl); } catch (Exception e) { e.printStackTrace(); throw new Exception("Error in getDocumentFromDtl", e); } }