From 20689558ce4a30b369644e9cf31619237490517f Mon Sep 17 00:00:00 2001 From: pdanner Date: Thu, 13 Sep 2007 09:36:37 +0000 Subject: went back to axis 1.0 in SP/SS (dsig-Namespaceproblem on provided Stylesheets), fixed bug in transactions entity-cache git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1008 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../moa/spss/server/invoke/DataObjectFactory.java | 14 +++++------- .../moa/spss/server/service/AxisHandler.java | 26 ++++++++++++++++++---- .../server/service/SignatureCreationService.java | 2 +- .../service/SignatureVerificationService.java | 2 +- .../server/transaction/TransactionContext.java | 5 +++-- 5 files changed, 32 insertions(+), 17 deletions(-) (limited to 'spss/server/serverlib/src/main/java/at') diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index ad0da28f4..0abd80944 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -191,6 +191,7 @@ public class DataObjectFactory { } // try to parse validating + Logger.trace(">>> parsing the following content: \n" + new String(contentBytes)); try { ByteArrayInputStream is = new ByteArrayInputStream(contentBytes); Document doc = @@ -201,6 +202,7 @@ public class DataObjectFactory { null, entityResolver, new MOAErrorHandler()); + Logger.trace("<<< parsed"); return new XMLDataObjectImpl(doc.getDocumentElement()); } catch (Exception e) { @@ -304,18 +306,12 @@ public class DataObjectFactory { } case Content.LOCREF_CONTENT: { - InputStream contentIS = null; String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); - TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); - Vector entity = context.FindResolvedEntity(locRefURI); - if (entity!=null) { - contentIS = (InputStream) entity.get(0); - } else { + if (context.FindResolvedEntity(locRefURI)==null) { ExternalURIResolver uriResolver = new ExternalURIResolver(); - InputStream uriStream = null; byte[] contentBytes; String contentType = null; @@ -323,7 +319,6 @@ public class DataObjectFactory { { uriStream = uriResolver.resolve(locRefURI); contentBytes = StreamUtils.readStream(uriStream); - contentIS = new ByteArrayInputStream(contentBytes); contentType = uriResolver.getContentType(); } catch (Exception e) @@ -334,9 +329,10 @@ public class DataObjectFactory { { closeInputStream(uriStream); } - entities.put(locRefURI, contentIS); context.PutResolvedEntity(locRefURI, contentBytes, contentType); } + InputStream contentIS = context.ResolveURI(locRefURI); + entities.put(reference, contentIS); break; } case Content.XML_CONTENT : diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index f5f77ff50..8e5c8a49b 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -1,6 +1,7 @@ package at.gv.egovernment.moa.spss.server.service; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -18,6 +19,8 @@ import org.apache.axis.handlers.BasicHandler; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.utils.Messages; import org.apache.axis.utils.XMLUtils; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -27,7 +30,6 @@ import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.logging.LoggingContext; import at.gv.egovernment.moa.logging.LoggingContextManager; import at.gv.egovernment.moa.spss.MOASystemException; -import at.gv.egovernment.moa.spss.api.common.Content; 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; @@ -105,7 +107,11 @@ public class AxisHandler extends BasicHandler { (X509Certificate[]) request.getAttribute(X509_CERTIFICATE_PROPERTY); //Configure Axis +// AxisProperties.setProperty(AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); +// AxisProperties.setProperty(AxisEngine.PROP_DOMULTIREFS,"false"); +// AxisProperties.setProperty(AxisEngine.PROP_SEND_XSI,"true"); //msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE); + //msgContext.setProperty(org.apache.axis. AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); Message soapMessage = msgContext.getCurrentMessage(); @@ -201,9 +207,21 @@ public class AxisHandler extends BasicHandler { info("handler.03", null); } if (Logger.isDebugEnabled()) { - String msg = soapMessage.getSOAPPartAsString(); - Logger.debug(new LogMsg(msg)); - } +// OutputFormat format = new OutputFormat((Document) xmlRequest.getOwnerDocument()); +// format.setLineSeparator("\n"); +// format.setIndenting(false); +// format.setPreserveSpace(true); +// format.setOmitXMLDeclaration(false); +// format.setEncoding("UTF-8"); +// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +// XMLSerializer conSerializer = new XMLSerializer(baos, format); +// conSerializer.serialize(xmlRequest); +// Logger.debug(new LogMsg("Request:" + baos.toString())); + + + String msg = soapMessage.getSOAPPartAsString(); + Logger.debug(new LogMsg(msg)); + } } catch (MOASystemException e) { MOASystemException se = new MOASystemException("2900", null, e); AxisFault fault = AxisFault.makeFault(se); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java index c173625f8..8fceb6fb6 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureCreationService.java @@ -70,7 +70,7 @@ public class SignatureCreationService { //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); // validate the request - reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + reparsedReq = ServiceUtils.reparseRequest(request[0]);//context.getRequest()); // convert to API objects Logger.trace(">>> preparsing Request"); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java index b335a6e23..feb49ffbf 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/service/SignatureVerificationService.java @@ -56,7 +56,7 @@ public class SignatureVerificationService { //since Axis (1.1 ff) has problem with namespaces we take the raw request stored by the Axishandler. TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); // validate the request - reparsedReq = ServiceUtils.reparseRequest(context.getRequest()); + reparsedReq = ServiceUtils.reparseRequest(request[0]);//context.getRequest()); // convert to API objects requestObj = requestParser.parse(reparsedReq); diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java index 5c1e35a95..62db42674 100644 --- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/transaction/TransactionContext.java @@ -273,8 +273,9 @@ public void cleanAttachmentCache() { if (mmds!=null) { InputStream is = mmds.getInputStream(); if (is!=null) is.close(); - File f = mmds.getDiskCacheFile(); - if (f!=null) f.delete(); +// not available in Axis 1.0 to 1.1 +// File f = mmds.getDiskCacheFile(); +// if (f!=null) f.delete(); mmds.delete(); } } catch (IOException e) { -- cgit v1.2.3