aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-06 15:55:34 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-06 15:55:34 +0200
commitaf2d6dad0711f95c280621b94f7ca3da8f91632a (patch)
tree4cc1ec16ca711ed6892cca2c0075177bcc8b9518 /pdf-as-web-client/src/test/java/at/gv/egiz/pdfas
parenta2b5bfc1203dfe53de937820d8b8dc59afbf56c3 (diff)
downloadpdf-as-4-af2d6dad0711f95c280621b94f7ca3da8f91632a.tar.gz
pdf-as-4-af2d6dad0711f95c280621b94f7ca3da8f91632a.tar.bz2
pdf-as-4-af2d6dad0711f95c280621b94f7ca3da8f91632a.zip
SOAP Bulk Request
Diffstat (limited to 'pdf-as-web-client/src/test/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest.java72
1 files changed, 62 insertions, 10 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 954d0e2e..aa672701 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
@@ -6,6 +6,8 @@ import java.net.URL;
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;
@@ -13,25 +15,75 @@ public class SimpleTest {
public static void main(String[] args) {
try {
- FileInputStream fis = new FileInputStream("/home/afitzek/simple.pdf");
+ FileInputStream fis = new FileInputStream(
+ "/home/afitzek/simple.pdf");
byte[] inputData = IOUtils.readFully(fis, -1, true);
-
+
PDFASSignParameters signParameters = new PDFASSignParameters();
signParameters.setConnector(Connector.JKS);
signParameters.setPosition(null);
signParameters.setProfile("SIGNATURBLOCK_DE");
-
- URL endpoint = new URL("http://localhost:8080/pdf-as-web/wssign?wsdl");
-
+
+ PDFASSignRequest request = new PDFASSignRequest();
+ request.setInputData(inputData);
+ 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://localhost:8080/pdf-as-web/wssign?wsdl");
+
RemotePDFSigner signer = new RemotePDFSigner(endpoint, false);
-
- byte[] outputFile = signer.signPDFDokument(inputData, signParameters);
-
- FileOutputStream fos = new FileOutputStream("/home/afitzek/signed.pdf");
+
+ System.out.println("Simple Request:");
+ byte[] outputFile = signer.signPDFDokument(inputData,
+ signParameters);
+
+ FileOutputStream fos = new FileOutputStream(
+ "/home/afitzek/simple_request_signed.pdf");
fos.write(outputFile);
fos.close();
+
+ System.out.println("Simple Request Obj:");
+ PDFASSignResponse response = signer.signPDFDokument(request);
+
+ if (response.getSignedPDF() != null) {
+ FileOutputStream fos2 = new FileOutputStream(
+ "/home/afitzek/simple_request_obj_signed.pdf");
+ fos2.write(response.getSignedPDF());
+ fos2.close();
+ }
+
+ if(response.getError() != null) {
+ System.out.println("ERROR: " + response.getError());
+ }
+
+ PDFASSignRequest[] bulk = new PDFASSignRequest[20];
+ for(int i = 0; i < bulk.length; i++) {
+ bulk[i] = request;
+ }
+
+ System.out.println("Bulk Request:");
+ PDFASSignResponse[] responses = signer.signPDFDokument(bulk);
+
+ for(int i = 0; i < responses.length; i++) {
+ PDFASSignResponse bulkresponse = responses[i];
+ System.out.println("ID: " + bulkresponse.getRequestID());
+
+ if (bulkresponse.getSignedPDF() != null) {
+ FileOutputStream fos2 = new FileOutputStream(
+ "/home/afitzek/simple_request_obj_signed_"+ i +".pdf");
+ fos2.write(bulkresponse.getSignedPDF());
+ fos2.close();
+ }
+
+ if(bulkresponse.getError() != null) {
+ System.out.println("ERROR: " + bulkresponse.getError());
+ }
+ }
- } catch(Throwable e) {
+ System.out.println("Done!");
+ } catch (Throwable e) {
e.printStackTrace();
}
}