aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignRequest.java27
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignResponse.java27
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java9
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java8
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignResponse.java8
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java6
-rw-r--r--pdf-as-web-client/src/main/java/at/gv/egiz/pdfas/web/client/RemotePDFSigner.java4
-rw-r--r--pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java21
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java45
9 files changed, 120 insertions, 35 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignRequest.java
new file mode 100644
index 00000000..01fe8db3
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignRequest.java
@@ -0,0 +1,27 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name="BulkSignRequest")
+public class PDFASBulkSignRequest implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2335377335418211956L;
+
+ List<PDFASSignRequest> signRequests;
+
+ @XmlElement(required = true, nillable = false, name="signRequests")
+ public List<PDFASSignRequest> getSignRequests() {
+ return signRequests;
+ }
+
+ public void setSignRequests(List<PDFASSignRequest> signRequests) {
+ this.signRequests = signRequests;
+ }
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignResponse.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignResponse.java
new file mode 100644
index 00000000..c89a1498
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASBulkSignResponse.java
@@ -0,0 +1,27 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name="BulkSignResponse")
+public class PDFASBulkSignResponse implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4218977934947700835L;
+
+ List<PDFASSignResponse> signResponses;
+
+ @XmlElement(required = true, nillable = false, name="signResponses")
+ public List<PDFASSignResponse> getSignResponses() {
+ return signResponses;
+ }
+
+ public void setSignResponses(List<PDFASSignResponse> signResponses) {
+ this.signResponses = signResponses;
+ }
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
index 070ca473..4f626e17 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
@@ -3,7 +3,9 @@ package at.gv.egiz.pdfas.api.ws;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+@XmlType(name="SignParameters")
public class PDFASSignParameters implements Serializable {
/**
@@ -11,6 +13,7 @@ public class PDFASSignParameters implements Serializable {
*/
private static final long serialVersionUID = -2375108993871456465L;
+ @XmlType(name="Connector")
public enum Connector {
JKS,
MOA
@@ -25,7 +28,7 @@ public class PDFASSignParameters implements Serializable {
String profile;
- @XmlElement(required = true, nillable = false)
+ @XmlElement(required = true, nillable = false, name="connector")
public Connector getConnector() {
return connector;
}
@@ -34,7 +37,7 @@ public class PDFASSignParameters implements Serializable {
this.connector = connector;
}
- @XmlElement(required = false, nillable = true)
+ @XmlElement(required = false, nillable = true, name="position")
public String getPosition() {
return position;
}
@@ -42,7 +45,7 @@ public class PDFASSignParameters implements Serializable {
this.position = position;
}
- @XmlElement(required = false, nillable = true)
+ @XmlElement(required = false, nillable = true, name="profile")
public String getProfile() {
return profile;
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java
index c875171d..e0d87004 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java
@@ -3,7 +3,9 @@ package at.gv.egiz.pdfas.api.ws;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+@XmlType(name="SignRequest")
public class PDFASSignRequest implements Serializable {
/**
@@ -15,7 +17,7 @@ public class PDFASSignRequest implements Serializable {
byte[] inputData;
PDFASSignParameters parameters;
- @XmlElement(required = true, nillable = false)
+ @XmlElement(required = true, nillable = false, name="requestID")
public String getRequestID() {
return requestID;
}
@@ -24,7 +26,7 @@ public class PDFASSignRequest implements Serializable {
this.requestID = requestID;
}
- @XmlElement(required = true, nillable = false)
+ @XmlElement(required = true, nillable = false, name="inputData")
public byte[] getInputData() {
return inputData;
}
@@ -33,7 +35,7 @@ public class PDFASSignRequest implements Serializable {
this.inputData = inputData;
}
- @XmlElement(required = true, nillable = false)
+ @XmlElement(required = true, nillable = false, name="parameters")
public PDFASSignParameters getParameters() {
return parameters;
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignResponse.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignResponse.java
index a27d1afe..1da4fa98 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignResponse.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignResponse.java
@@ -3,7 +3,9 @@ package at.gv.egiz.pdfas.api.ws;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+@XmlType(name="SignResponse")
public class PDFASSignResponse implements Serializable {
/**
@@ -15,7 +17,7 @@ public class PDFASSignResponse implements Serializable {
String error;
byte[] signedPDF;
- @XmlElement(required = true, nillable = false)
+ @XmlElement(required = true, nillable = false, name="requestID")
public String getRequestID() {
return requestID;
}
@@ -23,7 +25,7 @@ public class PDFASSignResponse implements Serializable {
this.requestID = requestID;
}
- @XmlElement(required = false, nillable = false)
+ @XmlElement(required = false, nillable = false, name="signedPDF")
public byte[] getSignedPDF() {
return signedPDF;
}
@@ -31,7 +33,7 @@ public class PDFASSignResponse implements Serializable {
this.signedPDF = signedPDF;
}
- @XmlElement(required = false)
+ @XmlElement(required = false, name="error")
public String getError() {
return error;
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
index 5d283cf7..63049bc5 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
@@ -2,6 +2,7 @@ package at.gv.egiz.pdfas.api.ws;
import javax.jws.WebMethod;
import javax.jws.WebParam;
+import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@@ -10,11 +11,14 @@ import javax.jws.soap.SOAPBinding.Style;
@SOAPBinding(style = Style.RPC)
public interface PDFASSigning {
@WebMethod(operationName = "sign")
+ @WebResult(name="signedPDF")
public byte[] signPDFDokument(@WebParam(name = "pdfDocument")byte[] inputDocument, @WebParam(name = "parameters")PDFASSignParameters parameters);
@WebMethod(operationName = "signSingle")
+ @WebResult(name="signResponse")
public PDFASSignResponse signPDFDokument(@WebParam(name = "signRequest") PDFASSignRequest request);
@WebMethod(operationName = "signBulk")
- public PDFASSignResponse[] signPDFDokument(@WebParam(name = "signRequests") PDFASSignRequest[] request);
+ @WebResult(name="bulkResponse")
+ public PDFASBulkSignResponse signPDFDokument(@WebParam(name = "signBulkRequest") PDFASBulkSignRequest request);
}
diff --git a/pdf-as-web-client/src/main/java/at/gv/egiz/pdfas/web/client/RemotePDFSigner.java b/pdf-as-web-client/src/main/java/at/gv/egiz/pdfas/web/client/RemotePDFSigner.java
index 0a019152..456a3aaa 100644
--- a/pdf-as-web-client/src/main/java/at/gv/egiz/pdfas/web/client/RemotePDFSigner.java
+++ b/pdf-as-web-client/src/main/java/at/gv/egiz/pdfas/web/client/RemotePDFSigner.java
@@ -7,6 +7,8 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
+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;
@@ -41,7 +43,7 @@ public class RemotePDFSigner implements PDFASSigning {
return proxy.signPDFDokument(request);
}
- public PDFASSignResponse[] signPDFDokument(PDFASSignRequest[] request) {
+ public PDFASBulkSignResponse signPDFDokument(PDFASBulkSignRequest request) {
return proxy.signPDFDokument(request);
}
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 aa672701..161e45cc 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
@@ -3,13 +3,17 @@ 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;
import at.gv.egiz.pdfas.api.ws.PDFASSignResponse;
import at.gv.egiz.pdfas.web.client.RemotePDFSigner;
-import sun.misc.IOUtils;
public class SimpleTest {
@@ -58,16 +62,19 @@ public class SimpleTest {
System.out.println("ERROR: " + response.getError());
}
- PDFASSignRequest[] bulk = new PDFASSignRequest[20];
- for(int i = 0; i < bulk.length; i++) {
- bulk[i] = request;
+ List<PDFASSignRequest> bulk = new ArrayList<PDFASSignRequest>();
+ for(int i = 0; i < 10; i++) {
+ bulk.add(request);
}
+ PDFASBulkSignRequest bulkRequest = new PDFASBulkSignRequest();
+ bulkRequest.setSignRequests(bulk);
+
System.out.println("Bulk Request:");
- PDFASSignResponse[] responses = signer.signPDFDokument(bulk);
+ PDFASBulkSignResponse responses = signer.signPDFDokument(bulkRequest);
- for(int i = 0; i < responses.length; i++) {
- PDFASSignResponse bulkresponse = responses[i];
+ for(int i = 0; i < responses.getSignResponses().size(); i++) {
+ PDFASSignResponse bulkresponse = responses.getSignResponses().get(i);
System.out.println("ID: " + bulkresponse.getRequestID());
if (bulkresponse.getSignedPDF() != null) {
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;
}
}