aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdanner <pdanner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2008-01-15 17:26:00 +0000
committerpdanner <pdanner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2008-01-15 17:26:00 +0000
commit923c7b6da9eb81500c29e2a68ffc0f4a863d90d7 (patch)
tree8c2fcb7053ed47d4c14f902f45339eee251f1191
parent769e807a565bb0ebcab8073890883de31a9dde24 (diff)
downloadmoa-id-spss-923c7b6da9eb81500c29e2a68ffc0f4a863d90d7.tar.gz
moa-id-spss-923c7b6da9eb81500c29e2a68ffc0f4a863d90d7.tar.bz2
moa-id-spss-923c7b6da9eb81500c29e2a68ffc0f4a863d90d7.zip
Minor enhancements
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1056 d688527b-c9ab-4aba-bd8d-4036d912da1d
-rw-r--r--common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd2
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/CreateMandateResponse.java11
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SOAPConstants.java19
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java7
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWConstants.java66
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/config/ParepConfiguration.java5
6 files changed, 62 insertions, 48 deletions
diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd
index c0ceb1d2e..360789834 100644
--- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd
+++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd
@@ -472,7 +472,7 @@
<xsd:sequence>
<xsd:element name="ClientKeyStore" minOccurs="0">
<xsd:annotation>
- <xsd:documentation>URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendetwird, enthält</xsd:documentation>
+ <xsd:documentation>URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:simpleContent>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/CreateMandateResponse.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/CreateMandateResponse.java
index 0f6ed8abf..f69a5a739 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/CreateMandateResponse.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/CreateMandateResponse.java
@@ -90,7 +90,15 @@ public class CreateMandateResponse {
// first check if response is a soap error
NodeList list = response.getElementsByTagName("faultstring");
if (list.getLength() > 0) {
- throw new SZRGWClientException("Fehler bei SZR-Gateway: "+list.item(0).getChildNodes().item(0).getNodeValue());
+ String faultCode = "";
+ String faultString = "";
+ Element snameSpaceNode = response.getOwnerDocument().createElement("NameSpaceNode");
+ snameSpaceNode.setAttribute("xmlns" + SOAPConstants.SOAP_ENV_POSTFIX, SOAPConstants.SOAP_ENV_NS);
+ Node faultCodeNode = XPathAPI.selectSingleNode(response, SOAPConstants.XPATH_SOAP_FAULTCODE, snameSpaceNode);
+ Node faultStringNode = XPathAPI.selectSingleNode(response, SOAPConstants.XPATH_SOAP_FAULTSTRING, snameSpaceNode);
+ if (faultCodeNode!=null) faultCode = faultCodeNode.getNodeValue();
+ if (faultStringNode!=null) faultString = faultStringNode.getNodeValue();
+ throw new SZRGWClientException("Fehler bei SZR-Gateway (SOAP-Error " + faultCodeNode + "): " + faultString);
}
this.mandate = null;
@@ -100,7 +108,6 @@ public class CreateMandateResponse {
Element nameSpaceNode = response.getOwnerDocument().createElement("NameSpaceNode");
nameSpaceNode.setAttribute("xmlns" + SZRGWConstants.SZRGW_POSTFIX, SZRGWConstants.SZRGW_REQUEST_NS);
nameSpaceNode.setAttribute("xmlns" + SZRGWConstants.MANDATE_POSTFIX, SZRGWConstants.MANDATE_NS);
-
Node mandateNode = XPathAPI.selectSingleNode(response, "//" + SZRGWConstants.SZRGW_PREFIX + SZRGWConstants.CREATE_MANDATE_RESPONSE + "/" + SZRGWConstants.MANDATE_PREFIX + SZRGWConstants.MANDATE, nameSpaceNode);
if (mandateNode!=null) {
this.mandate = (Element) mandateNode;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SOAPConstants.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SOAPConstants.java
index d9d248c81..ca914bbab 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SOAPConstants.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SOAPConstants.java
@@ -11,13 +11,18 @@ public interface SOAPConstants {
/*
* Namespaces and namespace prefixes for SOAP message handling
*/
- String SOAP_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
- String SOAP_ENV_ENCODING_STYLE = "http://schemas.xmlsoap.org/soap/encoding/";
- String SOAP_ENV_PREFIX = "soapenv:";
- String SOAP_ENV_POSTFIX = ":soapenv";
+ public static final String SOAP_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
+ public static final String SOAP_ENV_ENCODING_STYLE = "http://schemas.xmlsoap.org/soap/encoding/";
+ public static final String SOAP_ENV_PREFIX = "soapenv:";
+ public static final String SOAP_ENV_POSTFIX = ":soapenv";
- String ENVELOPE = "Envelope";
- String BODY = "Body";
- String ENCODING_STYLE = "encodingStyle";
+ public static final String ENVELOPE = "Envelope";
+ public static final String BODY = "Body";
+ public static final String FAULT = "Fault";
+ public static final String ENCODING_STYLE = "encodingStyle";
+
+ public static final String XPATH_SOAP_FAULT = "/" + SOAP_ENV_PREFIX + ENVELOPE + "/" + SOAP_ENV_PREFIX + BODY + "/" + SOAP_ENV_PREFIX + FAULT;
+ public static final String XPATH_SOAP_FAULTCODE = XPATH_SOAP_FAULT + "/faultcode/text()";
+ public static final String XPATH_SOAP_FAULTSTRING = XPATH_SOAP_FAULT + "/faultstring/text()";
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java
index 1e6dc1039..22f3cfffd 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWClient.java
@@ -3,9 +3,10 @@ package at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.security.Security;
+import java.io.File;
import javax.net.ssl.SSLSocketFactory;
+
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.protocol.Protocol;
@@ -13,7 +14,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import at.gv.egovernment.moa.id.auth.validator.parep.ParepUtils;
-import at.gv.egovernment.moa.id.config.ConfigurationException;
import at.gv.egovernment.moa.logging.Logger;
@@ -101,17 +101,18 @@ public class SZRGWClient {
soapBody.appendChild(doc.importNode(reqElem, true));
Element requestElement = soapBody.getOwnerDocument().getDocumentElement();
+ //ParepUtils.saveElementToFile(requestElement, new File("c:/szrRequest.xml"));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ParepUtils.serializeElementAsDocument(requestElement, bos);
method.setRequestBody(new ByteArrayInputStream(bos.toByteArray()));
-
client.executeMethod(method);
CreateMandateResponse response = new CreateMandateResponse();
bos = new ByteArrayOutputStream();
doc = ParepUtils.readDocFromIs(method.getResponseBodyAsStream());
+ //ParepUtils.saveElementToFile(doc.getDocumentElement(), new File("c:/szrResponse.xml"));
response.parse(doc.getDocumentElement());
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWConstants.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWConstants.java
index 4f815f1e7..006b2b9f2 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWConstants.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/client/szrgw/SZRGWConstants.java
@@ -8,44 +8,44 @@ package at.gv.egovernment.moa.id.auth.validator.parep.client.szrgw;
public interface SZRGWConstants {
//PersonData
- String PD_PREFIX = "pr:";
- String PD_POSTFIX = ":pr";
- String PERSON = "Person";
- String PHYSICALPERSON = "PhysicalPerson";
- String CORPORATEBODY = "CorporateBody";
- String IDENTIFICATION = "Identification";
- String VALUE = "Value";
- String TYPE = "Type";
- String NAME = "Name";
- String GIVENNAME = "GivenName";
- String FAMILYNAME = "FamilyName";
- String DATEOFBIRTH = "DateOfBirth";
- String FULLNAME = "FullName";
- String ORGANIZATION = "Organization";
+ public static final String PD_PREFIX = "pr:";
+ public static final String PD_POSTFIX = ":pr";
+ public static final String PERSON = "Person";
+ public static final String PHYSICALPERSON = "PhysicalPerson";
+ public static final String CORPORATEBODY = "CorporateBody";
+ public static final String IDENTIFICATION = "Identification";
+ public static final String VALUE = "Value";
+ public static final String TYPE = "Type";
+ public static final String NAME = "Name";
+ public static final String GIVENNAME = "GivenName";
+ public static final String FAMILYNAME = "FamilyName";
+ public static final String DATEOFBIRTH = "DateOfBirth";
+ public static final String FULLNAME = "FullName";
+ public static final String ORGANIZATION = "Organization";
- String POSTALADDRESS = "PostalAddress";
- String DELIVERYADDRESS = "DeliveryAddress";
- String MUNICIPALITY = "Municipality";
- String POSTALCODE = "PostalCode";
- String STREETNAME = "StreetName";
- String BUILDINGNUMBER = "BuildingNumber";
- String UNIT = "Unit";
+ public static final String POSTALADDRESS = "PostalAddress";
+ public static final String DELIVERYADDRESS = "DeliveryAddress";
+ public static final String MUNICIPALITY = "Municipality";
+ public static final String POSTALCODE = "PostalCode";
+ public static final String STREETNAME = "StreetName";
+ public static final String BUILDINGNUMBER = "BuildingNumber";
+ public static final String UNIT = "Unit";
//String ADDRESS = "Address";
//String COUNTRYCODE = "CountryCode";
//String DOORNUMBER = "DoorNumber";
// SZR-gateway constants
- String SZRGW_REQUEST_NS = "http://reference.e-government.gv.at/namespace/szrgw/20070807#";
- String MANDATE_NS = "http://reference.e-government.gv.at/namespace/mandates/20040701#";
- String SZRGW_PREFIX = "sgw:";
- String SZRGW_POSTFIX = ":sgw";
- String CREATE_MANDATE_REQUEST = "CreateMandateRequest";
- String CREATE_MANDATE_RESPONSE = "CreateMandateResponse";
- String ERROR_RESPONSE = "ErrorResponse";
- String MANDATOR = "Mandator";
- String REPRESENTATIVE = "Representative";
- String MANDATE = "Mandate";
- String MANDATE_PREFIX = "md:";
- String MANDATE_POSTFIX = ":md";
+ public static final String SZRGW_REQUEST_NS = "http://reference.e-government.gv.at/namespace/szrgw/20070807#";
+ public static final String MANDATE_NS = "http://reference.e-government.gv.at/namespace/mandates/20040701#";
+ public static final String SZRGW_PREFIX = "sgw:";
+ public static final String SZRGW_POSTFIX = ":sgw";
+ public static final String CREATE_MANDATE_REQUEST = "CreateMandateRequest";
+ public static final String CREATE_MANDATE_RESPONSE = "CreateMandateResponse";
+ public static final String ERROR_RESPONSE = "ErrorResponse";
+ public static final String MANDATOR = "Mandator";
+ public static final String REPRESENTATIVE = "Representative";
+ public static final String MANDATE = "Mandate";
+ public static final String MANDATE_PREFIX = "md:";
+ public static final String MANDATE_POSTFIX = ":md";
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/config/ParepConfiguration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/config/ParepConfiguration.java
index 16daa5452..e3a09b7dd 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/config/ParepConfiguration.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/validator/parep/config/ParepConfiguration.java
@@ -195,7 +195,7 @@ public class ParepConfiguration {
this.standardConnectionParameters = buildConnectionParameter(connectionParamElement, nameSpaceNode);
}
- Logger.debug("Lade Konfiguration der Parteienvertreter");
+ Logger.trace("Lade Konfiguration der Parteienvertreter");
NodeList partyRepresentativeNodeList = XPathAPI.selectNodeList(configElement, Constants.MOA_ID_CONFIG_PREFIX + ":PartyRepresentation/"
+ Constants.MOA_ID_CONFIG_PREFIX + ":PartyRepresentative", nameSpaceNode);
for (int i = 0; i < partyRepresentativeNodeList.getLength(); i++) {
@@ -233,7 +233,7 @@ public class ParepConfiguration {
partyRepresentative.setConnectionParameters(buildConnectionParameter(connectionParamSubElement, nameSpaceNode));
}
partyRepresentatives.put(partyRepresentative.getOid(), partyRepresentative);
- Logger.info("Parteienvertreter: " + partyRepresentative.getOid() + " erfolgreich konfiguriert (representPhysicalParty="
+ Logger.debug("Parteienvertreter: " + partyRepresentative.getOid() + " erfolgreich konfiguriert (representPhysicalParty="
+ partyRepresentative.isRepresentingPhysicalParty() + ", representCorporateParty=" + partyRepresentative.isRepresentingCorporateParty()
+ ", representationText=" + partyRepresentative.getRepresentationText()
+ ")");
@@ -386,6 +386,7 @@ public class ParepConfiguration {
public static boolean isMandateCompatibilityMode(Element configElement) throws ConfigurationException {
try {
+ if (configElement==null) return false;
Element nameSpaceNode = configElement.getOwnerDocument().createElement("NameSpaceNode");
nameSpaceNode.setAttribute("xmlns:" + Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI);
Node mandateCompatibilityNode = XPathAPI.selectSingleNode(configElement, Constants.MOA_ID_CONFIG_PREFIX + ":CompatibilityMode/text()", nameSpaceNode);