From 370af0e71a27a9e0a3970d1eabe83dabc4d1a1a9 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 5 Jun 2014 15:02:09 +0200 Subject: fixed Position String for SOAP service --- .../java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java | 15 +++++---------- .../java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 6 +++--- .../at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 3 ++- .../gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java | 3 ++- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java b/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java index 32c6dbad..e922c501 100644 --- a/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java +++ b/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java @@ -1,14 +1,9 @@ package at.gv.egiz.pdfas.web.client.test; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.net.URL; -import java.util.ArrayList; -import java.util.List; import sun.misc.IOUtils; -import at.gv.egiz.pdfas.api.ws.PDFASBulkSignRequest; -import at.gv.egiz.pdfas.api.ws.PDFASBulkSignResponse; import at.gv.egiz.pdfas.api.ws.PDFASSignParameters; import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector; import at.gv.egiz.pdfas.api.ws.PDFASSignRequest; @@ -24,7 +19,7 @@ public class SimpleTest { byte[] inputData = IOUtils.readFully(fis, -1, true); PDFASSignParameters signParameters = new PDFASSignParameters(); - signParameters.setConnector(Connector.BKU); + signParameters.setConnector(Connector.ONLINEBKU); signParameters.setPosition(null); signParameters.setProfile("SIGNATURBLOCK_DE"); @@ -33,12 +28,12 @@ public class SimpleTest { request.setParameters(signParameters); request.setRequestID("SOME TEST ID"); - // URL endpoint = new - // URL("http://demo.egiz.gv.at/demoportal-pdf_as/wssign?wsdl"); + URL endpoint = new + URL("http://demo.egiz.gv.at/demoportal-pdf_as/wssign?wsdl"); //URL endpoint = new URL( // "http://localhost:8080/pdf-as-web/wssign?wsdl"); - URL endpoint = new URL( - "http://192.168.56.10/pdf-as-web/wssign?wsdl"); + //URL endpoint = new URL( + // "http://192.168.56.10/pdf-as-web/wssign?wsdl"); RemotePDFSigner signer = new RemotePDFSigner(endpoint, false); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java index 421edff4..f64ffac0 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java @@ -139,7 +139,7 @@ public class PdfAsHelper { } } - private static String buildPosString(HttpServletRequest request, + public static String buildPosString(HttpServletRequest request, HttpServletResponse response) throws PdfAsWebException { String posP = PdfAsParameterExtractor.getSigPosP(request); String posX = PdfAsParameterExtractor.getSigPosX(request); @@ -388,7 +388,7 @@ public class PdfAsHelper { public static void startSignature(HttpServletRequest request, HttpServletResponse response, ServletContext context, byte[] pdfData, - String connector, String transactionId) + String connector, String position, String transactionId) throws Exception { // TODO: Protect session so that only one PDF can be signed during one @@ -441,7 +441,7 @@ public class PdfAsHelper { signParameter.setOutput(dataSink); // set Signature Position - signParameter.setSignaturePosition(buildPosString(request, response)); + signParameter.setSignaturePosition(position); StatusRequest statusRequest = pdfAs.startSign(signParameter); session.setAttribute(PDF_STATUS, statusRequest); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index a7d82c3e..70535573 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -280,7 +280,8 @@ public class ExternSignServlet extends HttpServlet { } } - PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector, transactionId); + PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector, + PdfAsHelper.buildPosString(request, response), transactionId); } else if (connector.equals("jks") || connector.equals("moa")) { // start synchronous siganture creation diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java index 3aad5abb..25b2b4c0 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java @@ -103,7 +103,8 @@ public class UIEntryPointServlet extends HttpServlet { } PdfAsHelper.startSignature(req, resp, getServletContext(), pdfAsRequest.getInputData(), - connector.toString(), pdfAsRequest.getParameters().getTransactionId()); + connector.toString(), pdfAsRequest.getParameters().getPosition(), + pdfAsRequest.getParameters().getTransactionId()); } else { throw new PdfAsWebException("Invalid connector (" + Connector.BKU + " | " + Connector.ONLINEBKU + " | " + Connector.MOBILEBKU + ")"); } -- cgit v1.2.3