summaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/util/client
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2014-07-04 15:13:57 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2014-07-04 15:13:57 +0200
commit804dc4bcd6b3b0edbeae3e002727ace91ad77797 (patch)
treeeb7a82bc7935cc32cf9dd6d4a74970192bf00b77 /src/main/java/at/gv/util/client
parent257f9b3de552defd8062635e3031c3d0c8ac42d4 (diff)
downloadegovutils-804dc4bcd6b3b0edbeae3e002727ace91ad77797.tar.gz
egovutils-804dc4bcd6b3b0edbeae3e002727ace91ad77797.tar.bz2
egovutils-804dc4bcd6b3b0edbeae3e002727ace91ad77797.zip
change SZR-GW webservice and MIS-STORK webservice for monitoring
Diffstat (limited to 'src/main/java/at/gv/util/client')
-rw-r--r--src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java68
1 files changed, 55 insertions, 13 deletions
diff --git a/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java b/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java
index ab8acd8..947b558 100644
--- a/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java
+++ b/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java
@@ -39,6 +39,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.soap.SOAPBinding;
+import org.apache.xpath.XPathAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -55,10 +56,10 @@ import at.gv.util.wsdl.SignatureVerificationService;
import at.gv.util.xsd.moaspss.CreateXMLSignatureRequest;
import at.gv.util.xsd.moaspss.CreateXMLSignatureResponseType;
import at.gv.util.xsd.moaspss.ErrorResponseType;
+import at.gv.util.xsd.moaspss.VerifyCMSSignatureResponseType;
import at.gv.util.xsd.moaspss.VerifyXMLSignatureRequestType;
import at.gv.util.xsd.moaspss.VerifyXMLSignatureResponseType;
-import com.sun.org.apache.xpath.internal.XPathAPI;
import com.sun.xml.ws.developer.JAXWSProperties;
/**
@@ -203,12 +204,61 @@ public class MOASPSSClient {
}
}
+ public VerifyCMSSignatureResponseType sendCMSSignatureVerificationRequest(
+ String serviceURL, InputStream signatureVerificationRequest)
+ throws MOASPSSClientException {
+ log.debug("Verifying CMS signature using raw VerifyXMLSignatureRequest.");
+
+ try {
+ byte[] moaResponse = sendBasicSignatureVerificationRequest(serviceURL, signatureVerificationRequest);
+
+ JAXBContext ctx = JAXBContext
+ .newInstance(VerifyCMSSignatureResponseType.class.getPackage()
+ .getName());
+ JAXBElement<VerifyCMSSignatureResponseType> jaxbElement = (JAXBElement<VerifyCMSSignatureResponseType>) ctx
+ .createUnmarshaller()
+ .unmarshal(new ByteArrayInputStream(moaResponse));
+ VerifyCMSSignatureResponseType verifyXMLResponse = jaxbElement.getValue();
+ log.trace(new String(moaResponse));
+ return verifyXMLResponse;
+
+ } catch (JAXBException e) {
+ throw new MOASPSSClientException(e);
+
+ }
+
+
+ }
+
+
@SuppressWarnings("unchecked")
public VerifyXMLSignatureResponseType sendSignatureVerificationRequest(
String serviceURL, InputStream signatureVerificationRequest)
throws MOASPSSClientException {
log.debug("Verifying XML signature using raw VerifyXMLSignatureRequest.");
+ try {
+ byte[] moaResponse = sendBasicSignatureVerificationRequest(serviceURL, signatureVerificationRequest);
+
+ JAXBContext ctx = JAXBContext
+ .newInstance(VerifyXMLSignatureRequestType.class.getPackage()
+ .getName());
+ JAXBElement<VerifyXMLSignatureResponseType> jaxbElement = (JAXBElement<VerifyXMLSignatureResponseType>) ctx
+ .createUnmarshaller()
+ .unmarshal(new ByteArrayInputStream(moaResponse));
+ VerifyXMLSignatureResponseType verifyXMLResponse = jaxbElement.getValue();
+ log.trace(new String(moaResponse));
+ return verifyXMLResponse;
+
+ } catch (JAXBException e) {
+ throw new MOASPSSClientException(e);
+
+ }
+
+ }
+
+ private byte[] sendBasicSignatureVerificationRequest(String serviceURL, InputStream signatureVerificationRequest)
+ throws MOASPSSClientException {
// check for arguments
if (serviceURL == null) {
throw new NullPointerException("Argument 'serviceURL' must not be null.");
@@ -281,26 +331,18 @@ public class MOASPSSClient {
log.trace("Parsing MOA-SP response.");
byte[] moaResponse = MiscUtil.sourceToByteArray(response);
- JAXBContext ctx = JAXBContext
- .newInstance(VerifyXMLSignatureRequestType.class.getPackage()
- .getName());
- JAXBElement<VerifyXMLSignatureResponseType> jaxbElement = (JAXBElement<VerifyXMLSignatureResponseType>) ctx
- .createUnmarshaller()
- .unmarshal(new ByteArrayInputStream(moaResponse));
- VerifyXMLSignatureResponseType verifyXMLResponse = jaxbElement.getValue();
- log.trace(new String(moaResponse));
- return verifyXMLResponse;
+
+ return moaResponse;
+
} catch (TransformerException e) {
throw new MOASPSSClientException(e);
} catch (IOException e) {
throw new MOASPSSClientException(e);
- } catch (JAXBException e) {
- throw new MOASPSSClientException(e);
} catch (EgovUtilException e) {
throw new MOASPSSClientException(e);
}
}
-
+
public static boolean isSuccess(VerifyXMLSignatureResponseType verifyResult) {
if (verifyResult == null) {
throw new NullPointerException(