aboutsummaryrefslogtreecommitdiff
path: root/DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-04-08 07:50:20 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-04-08 07:50:20 +0200
commit50c500dd107d88988cbee8207c91a16b321d6136 (patch)
tree6abd06e3f126866534e155e40c2f7e933b5357d3 /DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java
parentec62813f4c0e8b3002d46f7bc315e7a27d720125 (diff)
parent41882a0c5601dda478c2749ac99c2087b864c912 (diff)
downloadmoa-id-spss-50c500dd107d88988cbee8207c91a16b321d6136.tar.gz
moa-id-spss-50c500dd107d88988cbee8207c91a16b321d6136.tar.bz2
moa-id-spss-50c500dd107d88988cbee8207c91a16b321d6136.zip
Merge tag 'MOA-ID-3.1.0' into development_preview
JoinUp Release
Diffstat (limited to 'DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java')
-rw-r--r--DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java105
1 files changed, 0 insertions, 105 deletions
diff --git a/DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java b/DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java
deleted file mode 100644
index 821d636a2..000000000
--- a/DocumentService/src/eu/stork/documentservice/utils/ExternalDocservice.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package eu.stork.documentservice.utils;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.soap.SOAPBinding;
-
-import eu.stork.documentservice.DocumentService;
-import eu.stork.documentservice.exceptions.DocumentServiceException;
-
-public class ExternalDocservice {
-
- /**
- * Get document from external DTL
- * @param documentTransferRequest the document transfer request (attribute query)
- * @param dtlUrl the URL of external DTL
- * @return the document found
- * @throws DocumentServiceException
- */
- public static byte[] getDocument(String documentTransferRequest, String dtlUrl) throws DocumentServiceException
- {
- if (documentTransferRequest != null && !documentTransferRequest.isEmpty())
- {
- if (dtlUrl != null && !dtlUrl.isEmpty())
- {
- try
- {
- URL url = new URL(dtlUrl);
-
- QName qname = new QName("http://stork.eu",
- "DocumentService");
-
- Service service = Service.create(url, qname);
- DocumentService docservice = service.getPort(DocumentService.class);
-
- BindingProvider bp = (BindingProvider) docservice;
- SOAPBinding binding = (SOAPBinding) bp.getBinding();
- binding.setMTOMEnabled(true);
-
- return docservice.getDocument(documentTransferRequest, dtlUrl);
- }
- catch (MalformedURLException e) {
- e.printStackTrace();
- throw new DocumentServiceException("DTL url is invalid.", e);
- }
- catch (Exception e) {
- e.printStackTrace();
- throw new DocumentServiceException(e);
- }
- }
- else
- throw new DocumentServiceException("DTL url is empty.");
- }
- else
- throw new DocumentServiceException("Document transfer request is empty.");
- }
-
- /**
- * Get document mime from external DTL
- * @param docId the document id
- * @param dtlUrl the URL of external DTL
- * @return the document mime found
- * @throws DocumentServiceException
- */
- public static String getDocumentMime(String docId, String dtlUrl) throws DocumentServiceException
- {
- if (docId != null && !docId.isEmpty())
- {
- if (dtlUrl != null && !dtlUrl.isEmpty())
- {
- try
- {
- URL url = new URL(dtlUrl);
-
- QName qname = new QName("http://stork.eu",
- "DocumentService");
-
- Service service = Service.create(url, qname);
- DocumentService docservice = service.getPort(DocumentService.class);
-
- BindingProvider bp = (BindingProvider) docservice;
- SOAPBinding binding = (SOAPBinding) bp.getBinding();
- binding.setMTOMEnabled(true);
-
- return docservice.getDocumentMime(docId, dtlUrl);
- }
- catch (MalformedURLException e) {
- e.printStackTrace();
- throw new DocumentServiceException("DTL url is invalid.", e);
- }
- catch (Exception e) {
- e.printStackTrace();
- throw new DocumentServiceException(e);
- }
- }
- else
- throw new DocumentServiceException("DTL url is empty.");
- }
- else
- throw new DocumentServiceException("Document Id is empty.");
- }
-}