From e86d9677b16f54850cbd4c91c9f714754a75b67b Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Mon, 14 Mar 2016 16:29:25 +0100 Subject: CXF Webservice classes, excluded for now --- cxfImplementations/ContextSetupAspect.java | 104 +++++++++++ cxfImplementations/PlainInputInterceptor.java | 22 +++ .../SignatureCreationServiceImpl.java | 187 ++++++++++++++++++++ .../SignatureVerificationServiceImpl.java | 196 +++++++++++++++++++++ cxfImplementations/SimpleCXFNonSpringServlet.java | 48 +++++ 5 files changed, 557 insertions(+) create mode 100644 cxfImplementations/ContextSetupAspect.java create mode 100644 cxfImplementations/PlainInputInterceptor.java create mode 100644 cxfImplementations/SignatureCreationServiceImpl.java create mode 100644 cxfImplementations/SignatureVerificationServiceImpl.java create mode 100644 cxfImplementations/SimpleCXFNonSpringServlet.java (limited to 'cxfImplementations') diff --git a/cxfImplementations/ContextSetupAspect.java b/cxfImplementations/ContextSetupAspect.java new file mode 100644 index 0000000..42ffd5e --- /dev/null +++ b/cxfImplementations/ContextSetupAspect.java @@ -0,0 +1,104 @@ +package at.gv.egovernment.moa.spss.server.webservice.impl; + +import java.security.cert.X509Certificate; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPMessageContext; + +import org.apache.cxf.transport.http.AbstractHTTPDestination; +import org.aspectj.lang.annotation.Aspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.logging.LoggingContext; +import at.gv.egovernment.moa.logging.LoggingContextManager; +import at.gv.egovernment.moa.spss.server.config.ConfigurationException; +import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; +import at.gv.egovernment.moa.spss.server.transaction.TransactionIDGenerator; + +@Aspect +public class ContextSetupAspect { + + private static final Logger logger = LoggerFactory.getLogger(ContextSetupAspect.class); + + /** The property name for accessing the X509 client certificate chain. */ + private static final String X509_CERTIFICATE_PROPERTY = "javax.servlet.request.X509Certificate"; + + /** The property name for accessing the SOAP action header. */ + private static final String SOAP_ACTION_HEADER = "soapaction"; + + /** + * Set up the thread-local contexts (TransactionContext and + * LoggingContext). + * + * @param context + * The TransactionContext to set for the current + * request. + */ + private static void setUpContexts(TransactionContext context) { + // set the transaction context in the TransactionContextManager + TransactionContextManager tcm = TransactionContextManager.getInstance(); + tcm.setTransactionContext(context); + + // set the logging context in the LoggingContextManager + LoggingContextManager lcm = LoggingContextManager.getInstance(); + LoggingContext lc = new LoggingContext(context.getTransactionID()); + lcm.setLoggingContext(lc); + } + + /** + * Tear down the thread-local contexts. + */ + private static void tearDownContexts() { + TransactionContextManager tcm = TransactionContextManager.getInstance(); + + // delete temporary files + TransactionContext context = tcm.getTransactionContext(); + context.cleanAttachmentCache(); + + // unset the transaction context + tcm.setTransactionContext(null); + + // unset the logging context + LoggingContextManager lcm = LoggingContextManager.getInstance(); + lcm.setLoggingContext(null); + } + + public static void setupContext(MessageContext messageContext, String targetService) throws ConfigurationException { + logger.debug("Context setup"); + + HttpServletRequest request = (HttpServletRequest) messageContext + .get(AbstractHTTPDestination.HTTP_REQUEST); + + X509Certificate[] clientCert = (X509Certificate[]) request.getAttribute(X509_CERTIFICATE_PROPERTY); + + ConfigurationProvider configuration = ConfigurationProvider.getInstance(); + + Element xmlRequest = null; + if (messageContext instanceof SOAPMessageContext) { + SOAPMessageContext soapMessageContext = (SOAPMessageContext) messageContext; + xmlRequest = soapMessageContext.getMessage().getSOAPPart().getDocumentElement(); + } + + TransactionContext context = new TransactionContext(TransactionIDGenerator.nextID(), clientCert, + configuration, xmlRequest, null); + + String soapAction = (String) request.getHeader(SOAP_ACTION_HEADER); + if ("\"\"".equals(soapAction)) { + // if http soap action header is empty + soapAction = targetService; + } + context.setRequestName(soapAction); + + setUpContexts(context); + } + + public static void cleanContext() { + logger.debug("Context clean up"); + tearDownContexts(); + } +} diff --git a/cxfImplementations/PlainInputInterceptor.java b/cxfImplementations/PlainInputInterceptor.java new file mode 100644 index 0000000..29bfb87 --- /dev/null +++ b/cxfImplementations/PlainInputInterceptor.java @@ -0,0 +1,22 @@ +package at.gv.egovernment.moa.spss.server.webservice.impl; + +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.phase.Phase; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PlainInputInterceptor extends AbstractSoapInterceptor { + private static final Logger logger = LoggerFactory.getLogger(PlainInputInterceptor.class); + + public PlainInputInterceptor() { + super(Phase.POST_PROTOCOL); + } + + @Override + public void handleMessage(SoapMessage message) throws Fault { + logger.debug("In Interceptor {}", message.getId()); + } + +} diff --git a/cxfImplementations/SignatureCreationServiceImpl.java b/cxfImplementations/SignatureCreationServiceImpl.java new file mode 100644 index 0000000..83e9055 --- /dev/null +++ b/cxfImplementations/SignatureCreationServiceImpl.java @@ -0,0 +1,187 @@ +package at.gv.egovernment.moa.spss.server.webservice.impl; + +import java.util.Collections; + +import javax.annotation.Resource; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.ws.WebServiceContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.moasig.CreateCMSSignatureRequest; +import at.gv.egiz.moasig.CreateCMSSignatureResponseType; +import at.gv.egiz.moasig.CreatePDFSignatureRequest; +import at.gv.egiz.moasig.CreatePDFSignatureResponseType; +import at.gv.egiz.moasig.CreateXMLSignatureRequest; +import at.gv.egiz.moasig.CreateXMLSignatureResponseType; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureCreationInvoker; +import at.gv.egovernment.moa.spss.server.invoke.PDFASInvoker; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureCreationInvoker; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContext; +import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager; +import at.gv.egovernment.moa.spss.server.webservice.CMSCreateSignatureBinding; +import at.gv.egovernment.moa.spss.server.webservice.PDFCreateSignatureBinding; +import at.gv.egovernment.moa.spss.server.webservice.SignatureCreationService; +import at.gv.egovernment.moa.spss.server.webservice.XMLCreateSignatureBinding; +import at.gv.egovernment.moa.spss.server.webservice.binding.CMSCreateSignatureBindingImpl; +import at.gv.egovernment.moa.spss.server.webservice.binding.PDFCreateSignatureBindingImpl; +import at.gv.egovernment.moa.spss.server.webservice.binding.XMLCreateSignatureBindingImpl; +import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRequest; +import at.gv.egovernment.moa.spss.server.xmlbind.CreatePDFRespone; +import at.gv.egovernment.moa.util.StreamUtils; + +@WebService(endpointInterface = "at.gv.egovernment.moa.spss.server.webservice.SignatureCreationService", portName = "SignatureCreationService", serviceName = "SignatureCreationService") +public class SignatureCreationServiceImpl implements SignatureCreationService { + + private static final Logger logger = LoggerFactory.getLogger(SignatureCreationServiceImpl.class); + + @Resource + private WebServiceContext context; + + private XMLCreateSignatureBinding xmlCreateSignatureBinding; + private CMSCreateSignatureBinding cmsCreateSignatureBinding; + private PDFCreateSignatureBinding pdfCreateSignatureBinding; + + public SignatureCreationServiceImpl() { + this.xmlCreateSignatureBinding = new XMLCreateSignatureBindingImpl(); + this.cmsCreateSignatureBinding = new CMSCreateSignatureBindingImpl(); + this.pdfCreateSignatureBinding = new PDFCreateSignatureBindingImpl(); + } + + @Override + @WebResult(name = "CreateXMLSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") + public CreateXMLSignatureResponseType createXMLSignature(CreateXMLSignatureRequest createXMLSignatureRequest) + throws Exception { + logger.info("createXMLSignature start"); + try { + logger.info("WebServiceContext: {}", context); + ContextSetupAspect.setupContext(context.getMessageContext(), "createXMLSignature"); + + XMLSignatureCreationInvoker invoker = XMLSignatureCreationInvoker.getInstance(); + + at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureRequest requestObj; + at.gv.egovernment.moa.spss.api.xmlsign.CreateXMLSignatureResponse responseObj; + + logger.trace(">>> preparsing Request"); + requestObj = this.xmlCreateSignatureBinding.buildXMLRequest(createXMLSignatureRequest); + logger.trace("<<< preparsed Request"); + + logger.trace(">>> creating Signature"); + // invoke the core logic + responseObj = invoker.createXMLSignature(requestObj, Collections.EMPTY_SET); + logger.trace("<<< created Signature"); + + logger.trace(">>> building Response"); + // map back to XML + CreateXMLSignatureResponseType response = this.xmlCreateSignatureBinding.buildXMLResponse(responseObj); + logger.trace("<<< built Response"); + + return response; + } catch (MOAException e) { + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } finally { + ContextSetupAspect.cleanContext(); + } + } + + @Override + @WebResult(name = "CreateCMSSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") + public CreateCMSSignatureResponseType createCMSSignature(CreateCMSSignatureRequest createCMSSignatureRequest) + throws Exception { + logger.info("createCMSSignature start"); + try { + logger.info("WebServiceContext: {}", context); + ContextSetupAspect.setupContext(context.getMessageContext(), "createCMSSignature"); + + CMSSignatureCreationInvoker invoker = CMSSignatureCreationInvoker.getInstance(); + + at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureRequest requestObj; + at.gv.egovernment.moa.spss.api.cmssign.CreateCMSSignatureResponse responseObj; + + logger.trace(">>> preparsing Request"); + requestObj = this.cmsCreateSignatureBinding.buildCMSRequest(createCMSSignatureRequest); + logger.trace("<<< preparsed Request"); + + logger.trace(">>> creating Signature"); + // invoke the core logic + responseObj = invoker.createCMSSignature(requestObj, Collections.EMPTY_SET); + logger.trace("<<< created Signature"); + + logger.trace(">>> building Response"); + // map back to XML + CreateCMSSignatureResponseType response = this.cmsCreateSignatureBinding.buildCMSResponse(responseObj); + logger.trace("<<< built Response"); + + return response; + + } catch (MOAException e) { + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } finally { + ContextSetupAspect.cleanContext(); + } + } + + //@Override + //@WebResult(name = "CreatePDFSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") + public CreatePDFSignatureResponseType createPDFSignature(CreatePDFSignatureRequest createPDFSignatureRequest) + throws Exception { + logger.info("createPDFSignature start"); + try { + logger.info("WebServiceContext: {}", context); + ContextSetupAspect.setupContext(context.getMessageContext(), "createPDFSignature"); + + CreatePDFRequest requestObj; + CreatePDFRespone responseObj; + + TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); + + // convert to API objects + logger.trace(">>> preparsing Request"); + requestObj = this.pdfCreateSignatureBinding.buildPDFRequest(createPDFSignatureRequest); + logger.trace("<<< preparsed Request"); + + logger.trace(">>> creating Signature"); + // invoke the core logic + responseObj = null;//PDFASInvoker.getInstance().createPDFSignature(requestObj, context.getTransactionID()); + logger.trace("<<< created Signature"); + + logger.trace(">>> building Response"); + // map back to XML + CreatePDFSignatureResponseType response = this.pdfCreateSignatureBinding.buildPDFResponse(responseObj); + logger.trace("<<< built Response"); + + return response; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } finally { + ContextSetupAspect.cleanContext(); + } + } + +} diff --git a/cxfImplementations/SignatureVerificationServiceImpl.java b/cxfImplementations/SignatureVerificationServiceImpl.java new file mode 100644 index 0000000..2f23cac --- /dev/null +++ b/cxfImplementations/SignatureVerificationServiceImpl.java @@ -0,0 +1,196 @@ +package at.gv.egovernment.moa.spss.server.webservice.impl; + +import java.util.ResourceBundle; + +import javax.annotation.Resource; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.ws.WebServiceContext; + +import org.apache.cxf.binding.soap.Soap12; +import org.apache.cxf.binding.soap.SoapFault; +import org.apache.cxf.common.i18n.Message; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.moasig.VerifyCMSSignatureRequest; +import at.gv.egiz.moasig.VerifyCMSSignatureResponseType; +import at.gv.egiz.moasig.VerifyPDFSignatureRequest; +import at.gv.egiz.moasig.VerifyPDFSignatureResponseType; +import at.gv.egiz.moasig.VerifyXMLSignatureRequest; +import at.gv.egiz.moasig.VerifyXMLSignatureResponseType; +import at.gv.egovernment.moa.spss.MOAException; +import at.gv.egovernment.moa.spss.MOASystemException; +import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker; +import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker; +import at.gv.egovernment.moa.spss.server.webservice.CMSVerifySignatureBinding; +import at.gv.egovernment.moa.spss.server.webservice.SignatureVerificationService; +import at.gv.egovernment.moa.spss.server.webservice.XMLVerifySignatureBinding; +import at.gv.egovernment.moa.spss.server.webservice.binding.CMSVerifySignatureBindingImpl; +import at.gv.egovernment.moa.spss.server.webservice.binding.XMLVerifySignatureBindingImpl; +import at.gv.egovernment.moa.util.StreamUtils; + +@WebService(endpointInterface = "at.gv.egovernment.moa.spss.server.webservice.SignatureVerificationService", portName = "SignatureVerificationService", serviceName = "SignatureVerificationService") +public class SignatureVerificationServiceImpl implements SignatureVerificationService { + + private static final Logger logger = LoggerFactory.getLogger(SignatureVerificationServiceImpl.class); + + @Resource + private WebServiceContext context; + + private XMLVerifySignatureBinding xmlVerifySignatureBinding; + private CMSVerifySignatureBinding cmsVerifySignatureBinding; + + public SignatureVerificationServiceImpl() { + this.xmlVerifySignatureBinding = new XMLVerifySignatureBindingImpl(); + this.cmsVerifySignatureBinding = new CMSVerifySignatureBindingImpl(); + } + + @Override + @WebResult(name = "VerifyXMLSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") + public VerifyXMLSignatureResponseType verifyXMLSignature(VerifyXMLSignatureRequest verifyXMLSignatureRequest) + throws Exception { + logger.info("verifyXMLSignature start"); + try { + logger.info("WebServiceContext: {}", context); + ContextSetupAspect.setupContext(context.getMessageContext(), "verifyXMLSignature"); + + XMLSignatureVerificationInvoker invoker = XMLSignatureVerificationInvoker.getInstance(); + + at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureRequest requestObj; + at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse responseObj; + + logger.trace(">>> preparsing Request"); + requestObj = this.xmlVerifySignatureBinding.buildXMLRequest(verifyXMLSignatureRequest); + logger.trace("<<< preparsed Request"); + + logger.trace(">>> verifying Signature"); + // invoke the core logic + responseObj = invoker.verifyXMLSignature(requestObj); + logger.trace("<<< verified Signature"); + + logger.trace(">>> building Response"); + // map back to XML + VerifyXMLSignatureResponseType response = this.xmlVerifySignatureBinding.buildXMLResponse(responseObj); + logger.trace("<<< built Response"); + + return response; + } catch (MOAException e) { + SoapFault soapFault = SoapFault.createFault(new org.apache.cxf.interceptor.Fault( + new Message(e.getMessage(), (ResourceBundle)null)), + Soap12.getInstance()); + soapFault.setDetail(e.toErrorResponse()); + + logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw soapFault; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } finally { + ContextSetupAspect.cleanContext(); + } + } + + @Override + @WebResult(name = "VerifyCMSSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") + public VerifyCMSSignatureResponseType verifyCMSSignature(VerifyCMSSignatureRequest verifyCMSSignatureRequest) + throws Exception { + logger.info("verifyCMSSignature start"); + try { + logger.info("WebServiceContext: {}", context); + ContextSetupAspect.setupContext(context.getMessageContext(), "verifyCMSSignature"); + + CMSSignatureVerificationInvoker invoker = CMSSignatureVerificationInvoker.getInstance(); + + at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest requestObj; + at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse responseObj; + + logger.trace(">>> preparsing Request"); + requestObj = this.cmsVerifySignatureBinding.buildCMSRequest(verifyCMSSignatureRequest); + logger.trace("<<< preparsed Request"); + + logger.trace(">>> verifying Signature"); + // invoke the core logic + responseObj = invoker.verifyCMSSignature(requestObj); + logger.trace("<<< verified Signature"); + + logger.trace(">>> building Response"); + // map back to XML + VerifyCMSSignatureResponseType response = this.cmsVerifySignatureBinding.buildCMSResponse(responseObj); + logger.trace("<<< built Response"); + + return response; + } catch (MOAException e) { + SoapFault soapFault = SoapFault.createFault(new org.apache.cxf.interceptor.Fault( + new Message(e.getMessage(), (ResourceBundle)null)), + Soap12.getInstance()); + soapFault.setDetail(e.toErrorResponse()); + + logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw soapFault; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } finally { + ContextSetupAspect.cleanContext(); + } + } + + @Override + @WebResult(name = "VerifyPDFSignatureResponseType", targetNamespace = "http://reference.e-government.gv.at/namespace/moa/20151109#") + public VerifyPDFSignatureResponseType verifyPDFSignature(VerifyPDFSignatureRequest verifyPDFSignatureRequest) + throws Exception { + logger.info("verifyPDFSignature start"); + try { + logger.info("WebServiceContext: {}", context); + ContextSetupAspect.setupContext(context.getMessageContext(), "verifyPDFSignature"); + + CMSSignatureVerificationInvoker invoker = CMSSignatureVerificationInvoker.getInstance(); + + at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureRequest requestObj; + at.gv.egovernment.moa.spss.api.cmsverify.VerifyCMSSignatureResponse responseObj; + + logger.trace(">>> preparsing Request"); + requestObj = this.cmsVerifySignatureBinding.buildPDFRequest(verifyPDFSignatureRequest); + logger.trace("<<< preparsed Request"); + + logger.trace(">>> verifying Signature"); + // invoke the core logic + responseObj = invoker.verifyCMSSignature(requestObj); + logger.trace("<<< verified Signature"); + + logger.trace(">>> building Response"); + // map back to XML + VerifyPDFSignatureResponseType response = this.cmsVerifySignatureBinding.buildPDFResponse(responseObj); + logger.trace("<<< built Response"); + + return response; + } catch (MOAException e) { + SoapFault soapFault = SoapFault.createFault(new org.apache.cxf.interceptor.Fault( + new Message(e.getMessage(), (ResourceBundle)null)), + Soap12.getInstance()); + soapFault.setDetail(e.toErrorResponse()); + + logger.debug("Anfrage zur Signaturpruefung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + throw soapFault; + } catch (Throwable t) { + MOASystemException e = new MOASystemException("2900", null, t); + logger.debug("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:" + + System.getProperty("line.separator") + StreamUtils.getStackTraceAsString(e)); + logger.error("Anfrage zur Signaturerstellung wurde nicht erfolgreich beendet:", e); + throw new Exception(e.getMessage()); + } finally { + ContextSetupAspect.cleanContext(); + } + } + +} diff --git a/cxfImplementations/SimpleCXFNonSpringServlet.java b/cxfImplementations/SimpleCXFNonSpringServlet.java new file mode 100644 index 0000000..9f1399f --- /dev/null +++ b/cxfImplementations/SimpleCXFNonSpringServlet.java @@ -0,0 +1,48 @@ +package at.gv.egovernment.moa.spss.server.webservice.impl; + +import javax.servlet.ServletConfig; +import javax.xml.ws.Endpoint; + +import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; +import org.apache.cxf.transport.servlet.CXFNonSpringServlet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SimpleCXFNonSpringServlet extends CXFNonSpringServlet { + + private static final Logger logger = LoggerFactory.getLogger(SimpleCXFNonSpringServlet.class); + + /** + * + */ + private static final long serialVersionUID = 8564433272673970611L; + + @Override + public void loadBus(ServletConfig servletConfig) { + super.loadBus(servletConfig); + try { + Bus bus = getBus(); + bus.getInInterceptors().add(new PlainInputInterceptor()); + BusFactory.setDefaultBus(bus); + Endpoint signatureCreationEndpoint = Endpoint.publish("/SignatureCreation", + new SignatureCreationServiceImpl()); + if (signatureCreationEndpoint instanceof org.apache.cxf.endpoint.Endpoint) { + org.apache.cxf.endpoint.Endpoint cxfSignatureCreationEndpoint = (org.apache.cxf.endpoint.Endpoint) signatureCreationEndpoint; + cxfSignatureCreationEndpoint.getInInterceptors().add(new PlainInputInterceptor()); + } + signatureCreationEndpoint.getProperties().put("schema-validation-enabled", "true"); + Endpoint signatureVerificationEndpoint = Endpoint.publish("/SignatureVerification", + new SignatureVerificationServiceImpl()); + if (signatureVerificationEndpoint instanceof org.apache.cxf.endpoint.Endpoint) { + org.apache.cxf.endpoint.Endpoint cxfSignatureVerificationEndpoint = (org.apache.cxf.endpoint.Endpoint) signatureVerificationEndpoint; + cxfSignatureVerificationEndpoint.getInInterceptors().add(new PlainInputInterceptor()); + } + + //signatureVerificationEndpoint.getProperties().put("schema-validation-enabled", "true"); + } catch (Throwable e) { + logger.error("Failed to setup CXF", e); + } + } + +} -- cgit v1.2.3