aboutsummaryrefslogtreecommitdiff
path: root/spss.handbook/clients/webservice
diff options
context:
space:
mode:
authorgregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2004-08-05 12:05:45 +0000
committergregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d>2004-08-05 12:05:45 +0000
commit2baad7fa9e23016a7d40977c8c4e6aa1aebc6ffd (patch)
treee8a69d27f282b810d288d45d0e43db5ec5b03b84 /spss.handbook/clients/webservice
parent0e1015514b0e02436a6863d7afe930008e9b6f26 (diff)
downloadmoa-id-spss-2baad7fa9e23016a7d40977c8c4e6aa1aebc6ffd.tar.gz
moa-id-spss-2baad7fa9e23016a7d40977c8c4e6aa1aebc6ffd.tar.bz2
moa-id-spss-2baad7fa9e23016a7d40977c8c4e6aa1aebc6ffd.zip
Neuorganisation des Handbuchs. Auslagerung in ein eigenes Projekt.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@163 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.handbook/clients/webservice')
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/axis-ant.jarbin0 -> 385010 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/axis.jarbin0 -> 1235721 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/commons-discovery.jarbin0 -> 71442 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/commons-logging.jarbin0 -> 31605 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/jaxrpc.jarbin0 -> 35759 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/log4j-1.2.8.jarbin0 -> 352668 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/saaj.jarbin0 -> 18501 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/axis-1_1/wsdl4j.jarbin0 -> 113853 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jcert.jarbin0 -> 11321 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jnet.jarbin0 -> 5830 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jsse.jarbin0 -> 512635 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xercesImpl.jarbin0 -> 933730 bytes
-rw-r--r--spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xmlParserAPIs.jarbin0 -> 78440 bytes
-rw-r--r--spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1(pwd=kunde1).p12bin0 -> 3958 bytes
-rw-r--r--spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1.derbin0 -> 888 bytes
-rw-r--r--spss.handbook/clients/webservice/resources/sslKeys/customer1/trustedServers(pwd=servers).keystorebin0 -> 943 bytes
-rw-r--r--spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2(pwd=kunde2).p12bin0 -> 3966 bytes
-rw-r--r--spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2.derbin0 -> 888 bytes
-rw-r--r--spss.handbook/clients/webservice/resources/sslKeys/customer2/trustedServers(pwd=servers).keystorebin0 -> 943 bytes
-rw-r--r--spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTP.java114
-rw-r--r--spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSClientAuth.java154
-rw-r--r--spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSServerAuth.java142
22 files changed, 410 insertions, 0 deletions
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/axis-ant.jar b/spss.handbook/clients/webservice/lib/axis-1_1/axis-ant.jar
new file mode 100644
index 000000000..9cb30a98a
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/axis-ant.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/axis.jar b/spss.handbook/clients/webservice/lib/axis-1_1/axis.jar
new file mode 100644
index 000000000..869ee16f5
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/axis.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/commons-discovery.jar b/spss.handbook/clients/webservice/lib/axis-1_1/commons-discovery.jar
new file mode 100644
index 000000000..b88554847
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/commons-discovery.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/commons-logging.jar b/spss.handbook/clients/webservice/lib/axis-1_1/commons-logging.jar
new file mode 100644
index 000000000..b99c9375a
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/commons-logging.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/jaxrpc.jar b/spss.handbook/clients/webservice/lib/axis-1_1/jaxrpc.jar
new file mode 100644
index 000000000..5f6a56f02
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/jaxrpc.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/log4j-1.2.8.jar b/spss.handbook/clients/webservice/lib/axis-1_1/log4j-1.2.8.jar
new file mode 100644
index 000000000..493a3ccc1
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/log4j-1.2.8.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/saaj.jar b/spss.handbook/clients/webservice/lib/axis-1_1/saaj.jar
new file mode 100644
index 000000000..f2242abe5
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/saaj.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/axis-1_1/wsdl4j.jar b/spss.handbook/clients/webservice/lib/axis-1_1/wsdl4j.jar
new file mode 100644
index 000000000..820abd082
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/axis-1_1/wsdl4j.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jcert.jar b/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jcert.jar
new file mode 100644
index 000000000..d33134214
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jcert.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jnet.jar b/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jnet.jar
new file mode 100644
index 000000000..e1d340093
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jnet.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jsse.jar b/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jsse.jar
new file mode 100644
index 000000000..123188c5e
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/jsse-1_0_3/jsse-1_0_3.jsse.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xercesImpl.jar b/spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xercesImpl.jar
new file mode 100644
index 000000000..f25d73cd7
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xercesImpl.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xmlParserAPIs.jar b/spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xmlParserAPIs.jar
new file mode 100644
index 000000000..c1fa1d645
--- /dev/null
+++ b/spss.handbook/clients/webservice/lib/xerces-2_0_2/xerces-2_0_2.xmlParserAPIs.jar
Binary files differ
diff --git a/spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1(pwd=kunde1).p12 b/spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1(pwd=kunde1).p12
new file mode 100644
index 000000000..18d0bb6eb
--- /dev/null
+++ b/spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1(pwd=kunde1).p12
Binary files differ
diff --git a/spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1.der b/spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1.der
new file mode 100644
index 000000000..2844e3aab
--- /dev/null
+++ b/spss.handbook/clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1.der
Binary files differ
diff --git a/spss.handbook/clients/webservice/resources/sslKeys/customer1/trustedServers(pwd=servers).keystore b/spss.handbook/clients/webservice/resources/sslKeys/customer1/trustedServers(pwd=servers).keystore
new file mode 100644
index 000000000..d32a22f0f
--- /dev/null
+++ b/spss.handbook/clients/webservice/resources/sslKeys/customer1/trustedServers(pwd=servers).keystore
Binary files differ
diff --git a/spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2(pwd=kunde2).p12 b/spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2(pwd=kunde2).p12
new file mode 100644
index 000000000..ca7c31276
--- /dev/null
+++ b/spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2(pwd=kunde2).p12
Binary files differ
diff --git a/spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2.der b/spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2.der
new file mode 100644
index 000000000..27b20cd71
--- /dev/null
+++ b/spss.handbook/clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2.der
Binary files differ
diff --git a/spss.handbook/clients/webservice/resources/sslKeys/customer2/trustedServers(pwd=servers).keystore b/spss.handbook/clients/webservice/resources/sslKeys/customer2/trustedServers(pwd=servers).keystore
new file mode 100644
index 000000000..d32a22f0f
--- /dev/null
+++ b/spss.handbook/clients/webservice/resources/sslKeys/customer2/trustedServers(pwd=servers).keystore
Binary files differ
diff --git a/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTP.java b/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTP.java
new file mode 100644
index 000000000..646c53947
--- /dev/null
+++ b/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTP.java
@@ -0,0 +1,114 @@
+package at.gv.egovernment.moa.spss.handbook.clients.webservice;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.rpc.Call;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
+
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+
+/**
+ * Diese Klasse implementiert einen einfachen Client für das MOA SP/SS Webservice mittels Apache Axis. Die
+ * Verbindung erfolgt ungesichert über HTTP.
+ */
+public class HTTP
+{
+ // Zugangspunkt für Signaturerstellung (SS)
+ private static final QName SERVICE_QNAME_ = new QName("SignatureCreation");
+ private static final String ENDPOINT_ = "http://localhost:8080/moa-spss/services/SignatureCreation";
+
+ // Zugangspunkt für Signaturprüfung (SP)
+// private static final QName SERVICE_QNAME_ = new QName("SignatureVerification");
+// private static final String ENDPOINT_ ="http://localhost:8080/moa-spss/services/SignatureVerification";
+
+ // Datei mit dem zu sendenden XML-Request
+ private static final String XML_REQUEST_FILENAME_ =
+ "clients/common/resources/requests/CreateXMLSignatureRequest1.xml";
+// "clients/common/resources/requests/CreateXMLSignatureRequest2.xml";
+// "clients/common/resources/requests/VerifyCMSSignatureRequest.xml";
+// "clients/common/resources/requests/VerifyXMLSignatureRequest1.xml";
+// "clients/common/resources/requests/VerifyXMLSignatureRequest2.xml";
+
+ /**
+ * Methode main.
+ *
+ * Enthält den Beispielcode der nötig ist um von Java aus auf MOA-SPSS zugreifen zu können. Der Zugriff
+ * passiert über das AXIS-Framework. Die Verbindung erfolgt ungesichert über HTTP.
+ *
+ * @param args Wird nicht verwendet.
+ */
+ public static void main(String[] args)
+ {
+ try
+ {
+ // Datei mit Request einlesen
+ FileInputStream inputStream = new FileInputStream(XML_REQUEST_FILENAME_);
+
+ // Parser/DOMBuilder instanzieren
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+
+ // XML Datei in einen DOM-Baum umwandeln
+ Document xmlRequest = builder.parse(inputStream);
+
+ // AXIS-Server instanzieren
+ Service service = ServiceFactory.newInstance().createService(SERVICE_QNAME_);
+
+ // Call öffnen
+ Call call = service.createCall();
+
+ // Neues BodyElement anlegen und mit dem DOM-Baum füllen
+ SOAPBodyElement body = new SOAPBodyElement(xmlRequest.getDocumentElement());
+ SOAPBodyElement[] params = new SOAPBodyElement[]
+ {
+ body
+ };
+
+ // Call mit Endpoint verknüpfen
+ call.setTargetEndpointAddress(ENDPOINT_);
+
+ // Call auslösen und die Antworten speichern
+ System.out.println("Calling ...");
+ Vector responses = (Vector) call.invoke(params);
+
+ // Erstes Body Element auslesen
+ SOAPBodyElement response = (SOAPBodyElement) responses.get(0);
+
+ // Aus der Response den DOM-Baum lesen
+ Document root_response = response.getAsDocument();
+ System.out.println("Return ...");
+
+ // XML-Formatierung konfiguieren
+ OutputFormat format = new OutputFormat((Document) root_response);
+ format.setLineSeparator("\n");
+ format.setIndenting(false);
+ format.setPreserveSpace(true);
+ format.setOmitXMLDeclaration(false);
+ format.setEncoding("UTF-8");
+
+ // Ausgabe der Webservice-Antwort auf die Konsole
+ XMLSerializer conSerializer = new XMLSerializer(System.out, format);
+ conSerializer.serialize(root_response);
+
+ // Ausgabe der Webservice-Antwort in Datei
+ String responseFile = XML_REQUEST_FILENAME_.substring(0, XML_REQUEST_FILENAME_.lastIndexOf('.'))
+ + ".response.xml";
+ XMLSerializer fileSerializer = new XMLSerializer(new FileOutputStream(responseFile), format);
+ fileSerializer.serialize(root_response);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSClientAuth.java b/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSClientAuth.java
new file mode 100644
index 000000000..4d3b6641d
--- /dev/null
+++ b/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSClientAuth.java
@@ -0,0 +1,154 @@
+package at.gv.egovernment.moa.spss.handbook.clients.webservice;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.security.Security;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.rpc.Call;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
+
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+
+import com.sun.net.ssl.internal.ssl.Provider;
+
+/**
+ * Diese Klasse implementiert einen einfachen Client für das MOA SP/SS Webservice mittels Apache Axis. Die
+ * Verbindung erfolgt gesichert über SSL, und zwar sowohl mit Server- und Clientauthentisierung.
+ */
+public class HTTPSClientAuth
+{
+ // Zugangspunkt für Signaturerstellung (SS)
+ private static final QName SERVICE_QNAME_ = new QName("SignatureCreation");
+ private static final String SECURE_ENDPOINT_ = "https://localhost:8443/moa-spss/services/SignatureCreation";
+
+ // Zugangspunkt für Signaturprüfung (SP)
+// private static final QName SERVICE_QNAME_ = new QName("SignatureVerification");
+// private static final String SECURE_ENDPOINT_ = "https://localhost:8443/moa-spss/services/SignatureVerification";
+
+ // Datei mit dem zu sendenden XML-Request
+ private static final String XML_REQUEST_FILENAME_ =
+ "clients/common/resources/requests/CreateXMLSignatureRequest1.xml";
+// "clients/common/resources/requests/CreateXMLSignatureRequest2.xml";
+// "clients/common/resources/requests/VerifyCMSSignatureRequest.xml";
+// "clients/common/resources/requests/VerifyXMLSignatureRequest1.xml";
+// "clients/common/resources/requests/VerifyXMLSignatureRequest2.xml";
+
+ // SSL Konstanten
+ public static final String HANDLER = "java.protocol.handler.pkgs";
+
+ public static final String KEYSTORE = "javax.net.ssl.keyStore";
+ public static final String KEYSTOREPASSWORD = "javax.net.ssl.keyStorePassword";
+ public static final String KEYSTORETYPE = "javax.net.ssl.keyStoreType";
+
+ public static final String TRUSTSTORE = "javax.net.ssl.trustStore";
+ public static final String TRUSTSTOREPASSWORD = "javax.net.ssl.trustStorePassword";
+ public static final String TRUSTSTORETYPE = "javax.net.ssl.trustStoreType";
+
+ /**
+ * Methode main.
+ *
+ * Enthält den Beispielcode der nötig ist um von Java aus auf MOA-SPSS zugreifen zu können. Der Zugriff
+ * passiert über das AXIS-Framework. Die Verbindung ist eine SSL Verbindung mit Clientauthentisierung.
+ *
+ * @param args Wird nicht verwendet.
+ */
+ public static void main(String[] args)
+ {
+ try
+ {
+ configureSSL();
+
+ // Datei mit Request einlesen
+ FileInputStream inputStream = new FileInputStream(XML_REQUEST_FILENAME_);
+
+ // Parser/DOMBuilder instanzieren
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+
+ // XML Datei in einen DOM-Baum umwandeln
+ Document root_request = builder.parse(inputStream);
+
+ // AXIS-Server instanzieren
+ Service service = ServiceFactory.newInstance().createService(SERVICE_QNAME_);
+
+ // Call öffnen
+ Call call = service.createCall();
+
+ // Neues BodyElement anlegen und mit dem DOM-Baum füllen
+ SOAPBodyElement body = new SOAPBodyElement(root_request.getDocumentElement());
+ SOAPBodyElement[] params = new SOAPBodyElement[]
+ {
+ body
+ };
+
+ // Call mit Endpoint verknüpfen
+ call.setTargetEndpointAddress(SECURE_ENDPOINT_);
+
+ // Call auslösen und die Antworten speichern
+ System.out.println("Calling ...");
+ Vector responses = (Vector) call.invoke(params);
+
+ // Erstes BodyElement auslesen
+ SOAPBodyElement response = (SOAPBodyElement) responses.get(0);
+
+ // Aus der Response den DOM-Baum lesen
+ Document root_response = response.getAsDocument();
+ System.out.println("Return ...");
+
+ // XML-Formatierung konfiguieren
+ OutputFormat format = new OutputFormat((Document) root_response);
+ format.setLineSeparator("\n");
+ format.setIndenting(false);
+ format.setPreserveSpace(true);
+ format.setOmitXMLDeclaration(false);
+ format.setEncoding("UTF-8");
+
+ // Ausgabe der Webservice-Antwort auf die Konsole
+ XMLSerializer conSerializer = new XMLSerializer(System.out, format);
+ conSerializer.serialize(root_response);
+
+ // Ausgabe der Webservice-Antwort in Datei
+ String responseFile = XML_REQUEST_FILENAME_.substring(0, XML_REQUEST_FILENAME_.lastIndexOf('.'))
+ + ".response.xml";
+ XMLSerializer fileSerializer = new XMLSerializer(new FileOutputStream(responseFile), format);
+ fileSerializer.serialize(root_response);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Konfiguriert JSSE für eine SSL-Verbindung mit Client- und Serverauthentisierung.
+ */
+ private static void configureSSL()
+ {
+ Security.addProvider(new Provider());
+ System.setProperty(HANDLER, "com.sun.net.ssl.internal.www.protocol");
+
+ // Konfiguriere Key-Store (enthält privaten Schluessel und Zertifikat des Clients
+ System.setProperty(KEYSTORETYPE, "PKCS12");
+ System.setProperty(KEYSTORE,
+ "clients/webservice/resources/sslKeys/customer1/moa-ssl-kunde1(pwd=kunde1).p12");
+// "clients/webservice/resources/sslKeys/customer2/moa-ssl-kunde2(pwd=kunde2).p12");
+ System.setProperty(KEYSTOREPASSWORD, "kunde1");
+// System.setProperty(KEYSTOREPASSWORD, "kunde2");
+
+ // Konfiguriere Trust-Store (enthält SSL-Zertifikat des MOA Services, dem vertraut wird)
+ System.setProperty(TRUSTSTORETYPE, "JKS");
+ System.setProperty(TRUSTSTORE,
+ "clients/webservice/resources/sslKeys/customer1/trustedServers(pwd=servers).keystore");
+// "clients/webservice/resources/sslKeys/customer2/trustedServers(pwd=servers).keystore");
+ System.setProperty(TRUSTSTOREPASSWORD, "servers");
+ }
+} \ No newline at end of file
diff --git a/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSServerAuth.java b/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSServerAuth.java
new file mode 100644
index 000000000..cd5036b7d
--- /dev/null
+++ b/spss.handbook/clients/webservice/src/at/gv/egovernment/moa/spss/handbook/clients/webservice/HTTPSServerAuth.java
@@ -0,0 +1,142 @@
+package at.gv.egovernment.moa.spss.handbook.clients.webservice;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.security.Security;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.rpc.Call;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
+
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+
+import com.sun.net.ssl.internal.ssl.Provider;
+
+/**
+ * Diese Klasse implementiert einen einfachen Client für das MOA SP/SS Webservice mittels Apache Axis. Die
+ * Verbindung erfolgt gesichert über SSL, und zwar nur mit Serverauthentisierung.
+ */
+public class HTTPSServerAuth
+{
+ // Zugangspunkt für Signaturerstellung (SS)
+ private static final QName SERVICE_QNAME_ = new QName("SignatureCreation");
+ private static final String SECURE_ENDPOINT_ = "https://localhost:8443/moa-spss/services/SignatureCreation";
+
+ // Zugangspunkt für Signaturprüfung (SP)
+// private static final QName SERVICE_QNAME_ = new QName("SignatureVerification");
+// private static final String SECURE_ENDPOINT_ = "https://localhost:8443/moa-spss/services/SignatureVerification";
+
+ // Datei mit dem zu sendenden XML-Request
+ private static final String XML_REQUEST_FILENAME_ =
+ "clients/common/resources/requests/CreateXMLSignatureRequest1.xml";
+// "clients/common/resources/requests/CreateXMLSignatureRequest2.xml";
+// "clients/common/resources/requests/VerifyCMSSignatureRequest.xml";
+// "clients/common/resources/requests/VerifyXMLSignatureRequest1.xml";
+// "clients/common/resources/requests/VerifyXMLSignatureRequest2.xml";
+
+ // SSL Konstanten
+ public static final String HANDLER = "java.protocol.handler.pkgs";
+
+ public static final String TRUSTSTORE = "javax.net.ssl.trustStore";
+ public static final String TRUSTSTOREPASSWORD = "javax.net.ssl.trustStorePassword";
+ public static final String TRUSTSTORETYPE = "javax.net.ssl.trustStoreType";
+
+ /**
+ * Methode main.
+ *
+ * Enthält den Beispielcode der nötig ist um von Java aus auf MOA-SPSS zugreifen zu können. Der Zugriff
+ * passiert über das AXIS-Framework. Die Verbindung ist eine SSL Verbindung mit Serverauthentisierung.
+ *
+ * @param args Wird nicht verwendet.
+ */
+ public static void main(String[] args)
+ {
+ try
+ {
+ configureSSL();
+
+ // Datei mit Request einlesen
+ FileInputStream inputStream = new FileInputStream(XML_REQUEST_FILENAME_);
+
+ // Parser/DOMBuilder instanzieren
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+
+ // XML Datei in einen DOM-Baum umwandeln
+ Document root_request = builder.parse(inputStream);
+
+ // AXIS-Server instanzieren
+ Service service = ServiceFactory.newInstance().createService(SERVICE_QNAME_);
+
+ // Call öffnen
+ Call call = service.createCall();
+
+ // Neues BodyElement anlegen und mit dem DOM-Baum füllen
+ SOAPBodyElement body = new SOAPBodyElement(root_request.getDocumentElement());
+ SOAPBodyElement[] params = new SOAPBodyElement[]
+ {
+ body
+ };
+
+ // Call mit Endpoint verknüpfen
+ call.setTargetEndpointAddress(SECURE_ENDPOINT_);
+
+ // Call auslösen und die Antworten speichern
+ System.out.println("Calling ...");
+ Vector responses = (Vector) call.invoke(params);
+
+ // Erstes BodyElement auslesen
+ SOAPBodyElement response = (SOAPBodyElement) responses.get(0);
+
+ // Aus der Response den DOM-Baum lesen
+ Document root_response = response.getAsDocument();
+ System.out.println("Return ...");
+
+ // XML-Formatierung konfiguieren
+ OutputFormat format = new OutputFormat((Document) root_response);
+ format.setLineSeparator("\n");
+ format.setIndenting(false);
+ format.setPreserveSpace(true);
+ format.setOmitXMLDeclaration(false);
+ format.setEncoding("UTF-8");
+
+ // Ausgabe der Webservice-Antwort auf die Konsole
+ XMLSerializer conSerializer = new XMLSerializer(System.out, format);
+ conSerializer.serialize(root_response);
+
+ // Ausgabe der Webservice-Antwort in Datei
+ String responseFile = XML_REQUEST_FILENAME_.substring(0, XML_REQUEST_FILENAME_.lastIndexOf('.'))
+ + ".response.xml";
+ XMLSerializer fileSerializer = new XMLSerializer(new FileOutputStream(responseFile), format);
+ fileSerializer.serialize(root_response);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Konfiguriert JSSE für eine SSL-Verbindung mit Serverauthentisierung.
+ */
+ private static void configureSSL()
+ {
+ Security.addProvider(new Provider());
+ System.setProperty(HANDLER, "com.sun.net.ssl.internal.www.protocol");
+
+ // Konfiguriere Trust-Store (enthält SSL-Zertifikat des MOA Services, dem vertraut wird)
+ System.setProperty(TRUSTSTORETYPE, "JKS");
+ System.setProperty(TRUSTSTORE,
+ "clients/webservice/resources/sslKeys/customer1/trustedServers(pwd=servers).keystore");
+// "clients/webservice/resources/sslKeys/customer2/trustedServers(pwd=servers).keystore");
+ System.setProperty(TRUSTSTOREPASSWORD, "servers");
+ }
+} \ No newline at end of file