aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-07 09:27:33 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-07 09:27:33 +0200
commit6a588fa992b35eb3e31a3f183cbb7639288d2a57 (patch)
tree6cf8878350c27b27a7c3ed5ec9e08d5f8a38f910 /pdf-as-web/src/main/java/at/gv/egiz/pdfas
parente9410c03edfcfee9b6aa6dc5a27d6532292d72d8 (diff)
downloadpdf-as-4-6a588fa992b35eb3e31a3f183cbb7639288d2a57.tar.gz
pdf-as-4-6a588fa992b35eb3e31a3f183cbb7639288d2a57.tar.bz2
pdf-as-4-6a588fa992b35eb3e31a3f183cbb7639288d2a57.zip
XML Elements renaming for SOAP service
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java45
1 files changed, 28 insertions, 17 deletions
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 01f9205a..c8283d28 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
@@ -10,6 +10,8 @@ import javax.xml.ws.soap.MTOM;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+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.PDFASSignRequest;
import at.gv.egiz.pdfas.api.ws.PDFASSignResponse;
@@ -23,14 +25,15 @@ public class PDFASSigningImpl implements PDFASSigning {
private static final Logger logger = LoggerFactory
.getLogger(PDFASSigningImpl.class);
-
+
public byte[] signPDFDokument(byte[] inputDocument,
PDFASSignParameters parameters) {
try {
- return PdfAsHelper.synchornousServerSignature(inputDocument, parameters);
- } catch(Throwable e) {
+ return PdfAsHelper.synchornousServerSignature(inputDocument,
+ parameters);
+ } catch (Throwable e) {
logger.error("Server Signature failed.", e);
- if(WebConfiguration.isShowErrorDetails()) {
+ if (WebConfiguration.isShowErrorDetails()) {
throw new WebServiceException("Server Signature failed.", e);
} else {
throw new WebServiceException("Server Signature failed.");
@@ -39,15 +42,16 @@ public class PDFASSigningImpl implements PDFASSigning {
}
public PDFASSignResponse signPDFDokument(PDFASSignRequest request) {
- if(request == null) {
+ 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.setSignedPDF(signPDFDokument(request.getInputData(),
+ request.getParameters()));
+ } catch (Throwable e) {
+ if (e.getCause() != null) {
response.setError(e.getCause().getMessage());
} else {
response.setError(e.getMessage());
@@ -57,19 +61,26 @@ public class PDFASSigningImpl implements PDFASSigning {
return response;
}
- public PDFASSignResponse[] signPDFDokument(PDFASSignRequest[] request) {
+ public PDFASBulkSignResponse signPDFDokument(PDFASBulkSignRequest request) {
List<PDFASSignResponse> responses = new ArrayList<PDFASSignResponse>();
- for(int i = 0; i < request.length; i++) {
- PDFASSignResponse response = signPDFDokument(request[i]);
- if(response != null) {
- responses.add(response);
+ if (request.getSignRequests() != null) {
+ for (int i = 0; i < request.getSignRequests().size(); i++) {
+ PDFASSignResponse response = signPDFDokument(request
+ .getSignRequests().get(i));
+ if (response != null) {
+ responses.add(response);
+ }
}
+ PDFASBulkSignResponse response = new PDFASBulkSignResponse();
+ response.setSignResponses(responses);
+ return response;
}
- PDFASSignResponse[] array = new PDFASSignResponse[responses.size()];
- for(int i = 0; i < responses.size(); i++) {
- array[i] = responses.get(i);
+ logger.error("Server Signature failed. [PDFASBulkSignRequest is NULL]");
+ if (WebConfiguration.isShowErrorDetails()) {
+ throw new WebServiceException("PDFASBulkSignRequest is NULL");
+ } else {
+ throw new WebServiceException("Server Signature failed.");
}
- return array;
}
}