From af2d6dad0711f95c280621b94f7ca3da8f91632a Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 6 May 2014 15:55:34 +0200 Subject: SOAP Bulk Request --- .../at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'pdf-as-web/src/main') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java index 96829b26..01f9205a 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java @@ -1,5 +1,8 @@ package at.gv.egiz.pdfas.web.ws; +import java.util.ArrayList; +import java.util.List; + import javax.jws.WebService; import javax.xml.ws.WebServiceException; import javax.xml.ws.soap.MTOM; @@ -8,6 +11,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.api.ws.PDFASSignParameters; +import at.gv.egiz.pdfas.api.ws.PDFASSignRequest; +import at.gv.egiz.pdfas.api.ws.PDFASSignResponse; import at.gv.egiz.pdfas.api.ws.PDFASSigning; import at.gv.egiz.pdfas.web.config.WebConfiguration; import at.gv.egiz.pdfas.web.helper.PdfAsHelper; @@ -33,4 +38,38 @@ public class PDFASSigningImpl implements PDFASSigning { } } + public PDFASSignResponse signPDFDokument(PDFASSignRequest request) { + if(request == null) { + logger.warn("SOAP Sign Request is null!"); + return null; + } + PDFASSignResponse response = new PDFASSignResponse(); + try { + response.setSignedPDF(signPDFDokument(request.getInputData(), request.getParameters())); + } catch(Throwable e) { + if(e.getCause() != null) { + response.setError(e.getCause().getMessage()); + } else { + response.setError(e.getMessage()); + } + } + response.setRequestID(request.getRequestID()); + return response; + } + + public PDFASSignResponse[] signPDFDokument(PDFASSignRequest[] request) { + List responses = new ArrayList(); + for(int i = 0; i < request.length; i++) { + PDFASSignResponse response = signPDFDokument(request[i]); + if(response != null) { + responses.add(response); + } + } + PDFASSignResponse[] array = new PDFASSignResponse[responses.size()]; + for(int i = 0; i < responses.size(); i++) { + array[i] = responses.get(i); + } + return array; + } + } -- cgit v1.2.3