diff --git a/.travis.yml b/.travis.yml
index 4b06dda..7364663 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
sudo: false
-dist: trusty
+dist: focal
group: deprecated
language: java
@@ -8,15 +8,16 @@ notifications:
email: false
jdk:
- - oraclejdk8
+ - oraclejdk17
before_install:
- - wget --no-check-certificate https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
- - sha512sum -c apache-maven-3.6.3-bin.tar.gz.sha512
- - tar xzvf apache-maven-3.6.3-bin.tar.gz
- - export PATH=`pwd`/apache-maven-3.6.3/bin:$PATH
+ - wget https://archive.apache.org/dist/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz
+ - sha512sum -c apache-maven-3.9.5-bin.tar.gz.sha512
+ - tar xzvf apache-maven-3.9.5-bin.tar.gz
+ - export PATH=`pwd`/apache-maven-3.9.5/bin:$PATH
- mvn -v
script:
- mvn --version
+ # Skip unit test in CI
- mvn clean install
diff --git a/README.md b/README.md
index d8a94b4..67ce9a3 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,6 @@
# RSU B2B Sample Web Service Client written in Java
-[![Build Status](https://travis-ci.com/skat/rsu-b2b-sample-client-java.svg?token=pXpLRS1qCgHe3KVdbFyA&branch=master)](https://travis-ci.com/skat/rsu-b2b-sample-client-java)
-
-> **ModtagMomsangivelseForeloebig** is as of 2024 able to accept corrections to previous VAT returns going three (3) years back (as of current date). The service will return a notification code in the response telling if the submitted draft was (A) handled as the first VAT returns draft *OR* (B) if it was handled as a draft with the purpose of correcting a previously approved VAT returns. If your submitted draft is handled as a correction you will get code `5002` in `5002`. See the section [Notification codes related to transactions](#notification-codes-related-to-transactions) for futher details on these notification codes.
-
+[![Build Status](https://travis-ci.com/skat/rsu-b2b-sample-client-java.svg?token=pXpLRS1qCgHe3KVdbFyA&branch=master)](https://travis-ci.com/skat/rsu-b2b-sample-client-java) ![Java17](https://img.shields.io/badge/Java-17-green.svg)
This GitHub contains documentation and a sample client for the RSU B2B Web Service Gateway, that provides APIs (SOAP Web Services) to submit **VAT returns**. The [sample client](#about-the-client) is developed in Java and using open source libraries demonstrating how the APIs works.
@@ -44,7 +41,6 @@ This GitHub contains documentation and a sample client for the RSU B2B Web Servi
* [Run clients](#run-clients)
* [Prerequisites](#prerequisites)
* [Build and Run](#build-and-run)
- * [Run on Tomcat](#run-on-tomcat)
* [Change endpoints](#change-endpoints)
* [Add new environment and endpoints](#add-new-environment-and-endpoints)
* [Add another OCES3 certificate](#add-another-oces3-certificate)
@@ -68,11 +64,7 @@ The following diagram shows how the Web Services works.
The first web service to use is **VirksomhedKalenderHent**. This Web Service returns dates for which the legal entity has to submit VAT Returns by. These dates are required, when submitting VAT Returns.
-The second web service is **ModtagMomsangivelseForeloebig**. This Web Services submits a draft of the VAT Returns to skat.dk with all the fields you need to fill in. The Web Service returns a deep link to skat.dk, where the legal entity can access the submitted VAT Returns and approve it.
-
- **ModtagMomsangivelseForeloebig** is as of 2024 able to accept corrections to previous VAT returns going three (3) years back (as of current date). The service will return a notification code in the response telling if the submitted draft was (A) handled as the first VAT returns draft *OR* (B) if it was handled as a draft with the purpose of correcting a previously approved VAT returns. If your submitted draft is handled as a correction you will get code `5002` in `5002`.
-
-See the section [Notification codes related to transactions](#notification-codes-related-to-transactions) for futher details on these notification codes. This feature will enable RSU systems and their users to submit draft corrections to a VAT returns approved previously. The company still has to login on skat.dk and approve the submitted draft with corrections.
+The second web service is **ModtagMomsangivelseForeloebig**. This Web Services submits a draft of the VAT Returns to skat.dk with all the fields you need to fill in. The Web Service returns a deep link to skat.dk, where the legal entity can access the submitted VAT Returns and approve it.
The last web service is **MomsangivelseKvitteringHent**. This Web Service provide a receipt for the VAT Returns given that the legal entity has approved it. This service also includes payment information on how to pay any outstanding balance.
@@ -94,23 +86,26 @@ The web services are implemented as SOAP Web Services. This GitHub contains WSDL
### Security
-The Web Services are protected using both TLS over HTTPS and by WS-Security using a certificate to both encrypt and sign the requests.
+The Web Services are protected using both TLS over HTTPS and by WS-Security (using a certificate for signing the request and
+response).
**Transport Layer Security (TLS)**
-To be able to use the services, you need to add the server certificate to your trust store. You can find the certificates for both test and production in [pem/README.md](/pem/README.md).
+To be able to use the services, you need to add the server certificate to your trust store. You can find the certificates for both test and production here [https://github.com/skat/emcs-b2b-ws/tree/master/crt](https://github.com/skat/emcs-b2b-ws/tree/master/crt)
-The sample client in this GitHub already has the server certificate for the test environment in the trust store.
+The sample client in this GitHub repository comes prepared with server certificate for the test environment in the trust store.
**WS-Security Protocol**
To be able to use the Web Services you also need a company certificate (VOCES3) from MitID Erhverv (OCES3).
A company certificate for the test environment is provided by contacting Skattestyrelsen.
-To be able to use the services in production, you need to get an official company certificate. Information on how to get this is attached when you get access to the test environment.
+To be able to use the services in production, you need to get an official company certificate.
+Information on how to get this is attached when you get access to the test environment. See more on the security & certificates here:
+[https://github.com/skat/emcs-b2b-ws#security](https://github.com/skat/emcs-b2b-ws#security)
-The company certificate is used to sign (seal) the soap:body of the request and other additional security headers such a timestamp. The certificate is also used to validate the response.
+The company certificate is used to sign the payload. The certificate is also used to validate and decrypt the response.
-An example of a signed request can be found here: [rsu-b2b-sample-client/src/test/resources/VirksomhedKalenderHent_I_Document_Complete_With_SOAPENV.xml](rsu-b2b-sample-client/src/test/resources/VirksomhedKalenderHent_I_Document_Complete_With_SOAPENV.xml)
+An example of a signed payload can be found here: [rsu-b2b-sample-client/src/test/resources/VirksomhedKalenderHent_I_Document_Complete_With_SOAPENV.xml](/rsu-b2b-sample-client/src/test/resources/VirksomhedKalenderHent_I_Document_Complete_With_SOAPENV.xml)
### Legal Entity Identification
@@ -342,8 +337,6 @@ The RSU B2B Gateway generates two types of error code.
Error code | Error Description (EN) | Error Description (DA)
------------ | ------------- | -----------------------
- 471 | There are no VAT returns for the company | Der findes ingen angivelser for virksomheden
- 475 | There are no VAT returns for the requested periods in which the company has reported | Der findes ingen angivelser for de ønskede perioder hvor virksomheden har indberettet
4801 | RSU is not delegated by the legal entity (See [Onboard Legal Entities](#onboard-legal-entities)) | RSU er ikke delegeret af virksomheden
4802 | The VAT period is not open | Ikke åben periode
4803 | The VAT period has not ended | Periode ikke afsluttet
@@ -356,43 +349,11 @@ Error code | Error Description (EN) | Error Description (DA)
4817 | The search start date is later than the search end date | Søgedato start er efter søgedatoslut
-### Notification codes related to transactions
-
-The service **ModtagMomsangivelseForeloebig** will for every successful submition of a VAT declaration return a formal notice related to the transaction in the **Advis** section of the **HovedOplysningerSvar/SvarStruktur** structure. Example:
-
-```xml
-
- ...
- ...
- ...
-
-
- 5001
- Dette er en foreløbig ordinær angivelse
-
-
-
-```
-
-Please observe that notification codes are NOT the same as error codes
-
-The service will return either one of the two codes:
-
-Error code | Error Description (EN) | Error Description (DA)
------------- | ------------- | -----------------------
-5001 | This is a preliminary ordinary declaration pending user approval | Dette er en foreløbig ordinær angivelse
-5002 | This is a preliminary post declaration pending user approval | Dette er en foreløbig efterangivelse
-
-The service **MomsangivelseKvitteringHent** will - similar to **ModtagMomsangivelseForeloebig** - return the following notice codes once the user has approved the declaration submitted via **ModtagMomsangivelseForeloebig** via skat.dk:
-
-Error code | Error Description (EN) | Error Description (DA)
------------- | ------------- | -----------------------
-5003 | The post declaration has now been approved, a receipt is available on skat.dk | Din efterangivelse er nu godkendt, en kvittering er tilgængelig på skat.dk
-5004 | The ordinary declaration has now been approved, a receipt is available on skat.dk | Din ordinær angivelse er nu godkendt, en kvittering er tilgængelig på skat.dk
-
## About the client
-The following is documentation of a sample client for the RSU B2B Web Service Gateway. The sample client is implemented based on the [Apache CXF](http://cxf.apache.org/) framework, the Spring Framework, and Java 8. See `pom.xml` file in this repo for details regarding the current versions of the mentioned frameworks in use.
+The following is documentation of a sample client for the RSU B2B Web Service Gateway. The sample client is implemented based on the [Apache CXF](http://cxf.apache.org/) framework, the Spring Framework, and Java 17. See `pom.xml` file in this repo for details regarding the current versions of the mentioned frameworks in use.
+
+For a **Java 8** based client please take a look at release [v1.3](https://github.com/skat/rsu-b2b-sample-client-java/releases/tag/v1.3)
> **Looking for a .NET Core sample?** Skatteforvaltningen provides a sample Web Service Client written in .NET Core
> [here](https://github.com/skat/rsu-b2b-sample-client-dotnet).
@@ -484,17 +445,14 @@ call the test environment of RSU B2B Web Service Gateway.
The parameters (provided as a file named `app.conf`) can be obtained by contacting Skattestyrelsen.
-In the following sections we describe two methods for running the sample:
-
-* **Build and Run** - Clone repo, build repo, and run locally.
-* **Run on Tomcat** - Clone repo, build repo, and run on a Tomcat server.
+In the following sections we describe a simple method for running the sample.
### Prerequisites
-For both methods the following tools are required:
+The following tools are required:
-* JDK 1.8
-* Maven 3.3 (or above)
+* JDK 17
+* Maven 3.9.5
### Build and Run
@@ -519,47 +477,6 @@ Once Jetty is running open URL:
http://localhost:8080/rsu-b2b-sample-client-gui
```
-### Run on Tomcat
-
-Clone this repository. Then execute:
-
-```sh
-$ mvn clean install
-```
-
-On your **server** create a directory named `rsu-b2b-sample-client-gui`.
-
-Copy these files to the directory `rsu-b2b-sample-client-gui`:
-
-```
-rsu-b2b-sample-client-gui/target/rsu-b2b-sample-client-gui--war-exec.jar
-rsu-b2b-sample-client/src/main/resources/keystore/client-keystore.jks
-rsu-b2b-sample-client/src/main/resources/keystore/server-keystore.jks
-```
-
-Organize the files as follows:
-
-```
-rsu-b2b-sample-client-gui/
- rsu-b2b-sample-client-gui--war-exec.jar
- keystore/
- client-keystore.jks
- server-keystore.jks
- app.conf
-```
-
-Then inside `rsu-b2b-sample-client-gui` run:
-
-```sh
-$ java -jar rsu-b2b-sample-client-gui--war-exec.jar
-```
-
-Once Tomcat is running open URL:
-
-```
-http://localhost:8080/rsu-b2b-sample-client-gui
-```
-
### Change endpoints
If you want to have the test client call the built-in Log Servlet modify `app.conf` and
@@ -669,10 +586,10 @@ $ keytool -delete -alias skatserver -keystore client-truststore.jks -storepass s
Then you can add the new certificate to the trust store.
```sh
-$ keytool -import -alias skatserver -file newcert.crt -keystore client-truststore.jks -storepass storepassword
+$ keytool -import -alias skatserver -file emcs-b2b-server-prod-as-of-20171026.crt -keystore client-truststore.jks -storepass storepassword
```
## References
* [Apache CXF](http://cxf.apache.org/)
-* [Apache CXF Samples](https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples)
+* [Apache CXF Samples](https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples)
\ No newline at end of file
diff --git a/apache-maven-3.9.5-bin.tar.gz.sha512 b/apache-maven-3.9.5-bin.tar.gz.sha512
new file mode 100644
index 0000000..88ff458
--- /dev/null
+++ b/apache-maven-3.9.5-bin.tar.gz.sha512
@@ -0,0 +1 @@
+4810523ba025104106567d8a15a8aa19db35068c8c8be19e30b219a1d7e83bcab96124bf86dc424b1cd3c5edba25d69ec0b31751c136f88975d15406cab3842b apache-maven-3.9.5-bin.tar.gz
diff --git a/assets/rsu_sample_gui_snapshot.png b/assets/rsu_sample_gui_snapshot.png
index 6912b73..c261d00 100644
Binary files a/assets/rsu_sample_gui_snapshot.png and b/assets/rsu_sample_gui_snapshot.png differ
diff --git a/build-tomcat-package.sh b/build-tomcat-package.sh
deleted file mode 100755
index b573240..0000000
--- a/build-tomcat-package.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-rm -f rsu-b2b-sample-client-gui-tomcat-dist.zip
-rm -rf target
-PACKAGE_DIR=target/rsu-b2b-sample-client-gui
-mkdir -p $PACKAGE_DIR
-
-
-cp -r rsu-b2b-sample-client/src/main/resources/keystore $PACKAGE_DIR/
-cp rsu-b2b-sample-client-gui/target/rsu-b2b-sample-client-gui-*.war $PACKAGE_DIR/
-cp rsu-b2b-sample-client-gui/target/rsu-b2b-sample-client-gui-*-war-exec.jar $PACKAGE_DIR/
-cp rsu-b2b-sample-client-gui/src/main/resources/reference.conf $PACKAGE_DIR/app.conf
-cp start-tomcat.sh $PACKAGE_DIR/
-
-cd target
-zip -r rsu-b2b-sample-client-gui-tomcat-dist.zip rsu-b2b-sample-client-gui
-cd ../
-unzip -t target/rsu-b2b-sample-client-gui-tomcat-dist.zip
diff --git a/jetty-run.sh b/jetty-run.sh
index 5e80634..3bac0ae 100755
--- a/jetty-run.sh
+++ b/jetty-run.sh
@@ -1,8 +1,8 @@
#!/bin/sh
# remove symbolic link
-rm -f keystore
+# rm -f keystore
# create symbolic link
-ln -s rsu-b2b-sample-client/src/main/resources/keystore keystore
+# ln -s rsu-b2b-sample-client/src/main/resources/keystore keystore
mvn jetty:run -f rsu-b2b-sample-client-gui/pom.xml
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 2c25d35..3d4dc66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,31 +1,41 @@
-
- 4.0.0
- dk.skat.rsu.b2b.sample
- rsu-b2b-sample-client-java
- pom
- 1.3
- rsu-b2b-sample-client-java
- http://www.skat.dk
-
- rsu-b2b-sample-client
- rsu-b2b-sample-client-gui
-
-
- UTF-8
- UTF-8
-
-
-
-
-
-
-
-
- com.typesafe
- config
- 1.3.0
-
-
-
+ 4.0.0
+ dk.skat.rsu.b2b.sample
+ rsu-b2b-sample-client-java
+ pom
+ 1.4
+ rsu-b2b-sample-client-java
+ http://www.skat.dk
+
+ rsu-b2b-sample-client
+ rsu-b2b-sample-client-gui
+
+
+ UTF-8
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.10.1
+
+
+ 17
+
+
+
+
+
+
+
+ com.typesafe
+ config
+ 1.4.2
+
+
+
diff --git a/prep-local-tomcat.sh b/prep-local-tomcat.sh
deleted file mode 100755
index b948f45..0000000
--- a/prep-local-tomcat.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-cp -r rsu-b2b-sample-client/src/main/resources/keystore rsu-b2b-sample-client-gui/target/keystore
-cp app.conf rsu-b2b-sample-client-gui/target
-cp start-tomcat.sh rsu-b2b-sample-client-gui/target
\ No newline at end of file
diff --git a/rsu-b2b-sample-client-gui/pom.xml b/rsu-b2b-sample-client-gui/pom.xml
index 37bb7f7..e4870a3 100644
--- a/rsu-b2b-sample-client-gui/pom.xml
+++ b/rsu-b2b-sample-client-gui/pom.xml
@@ -1,107 +1,131 @@
-
- 4.0.0
-
- dk.skat.rsu.b2b.sample
- rsu-b2b-sample-client-java
- 1.3
-
- rsu-b2b-sample-client-gui
- war
- rsu-b2b-sample-client-gui
-
-
-
- org.eclipse.jetty
- jetty-maven-plugin
- 9.4.8.v20171121
-
- 10
-
- /rsu-b2b-sample-client-gui
-
-
-
-
- org.apache.tomcat.maven
- tomcat8-maven-plugin
- 3.0-r1756463
-
-
- tomcat-run
-
- exec-war-only
-
- package
-
-
-
-
-
-
- dk.skat.rsu.b2b.sample
- rsu-b2b-sample-client-gui
- war
- 1.0
-
- /
-
-
-
- true
-
-
-
-
-
-
-
-
-
+ 4.0.0
+
+ dk.skat.rsu.b2b.sample
+ rsu-b2b-sample-client-java
+ 1.4
+
+ rsu-b2b-sample-client-gui
+ war
+ rsu-b2b-sample-client-gui
+
+
+
+ org.eclipse.jetty
+ jetty-maven-plugin
+ 11.0.11
+
+ 1
+
+ /rsu-b2b-sample-client-gui
+
+
+
+
+
+
-
- junit
- junit
- 4.13.1
- test
-
-
- org.apache.struts
- struts2-core
- 6.3.0.1
-
-
- commons-io
- commons-io
- 2.7
-
-
- commons-fileupload
- commons-fileupload
- 1.5
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
-
- com.typesafe
- config
-
-
- dk.skat.rsu.b2b.sample
- rsu-b2b-sample-client
- ${project.version}
-
+
+ org.springframework
+ spring-framework-bom
+ 6.0.10
+ pom
+ import
+
+
+ org.springframework.security
+ spring-security-bom
+ pom
+ import
+ 6.0.2
+
+
+ org.slf4j
+ slf4j-api
+ 2.0.6
+
-
-
- artifacts.alfresco.com
- https://artifacts.alfresco.com/nexus/content/repositories/public/
-
-
+
+
+
+ org.springframework
+ spring-webmvc
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+ org.springframework.webflow
+ spring-webflow
+ 3.0.0
+
+
+ commons-io
+ commons-io
+ 2.11.0
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 6.0.0
+ provided
+
+
+ jakarta.enterprise
+ jakarta.enterprise.cdi-api
+ provided
+ 4.0.0.Beta2
+
+
+ org.springframework.security
+ spring-security-web
+
+
+ org.springframework.security
+ spring-security-taglibs
+
+
+ org.springframework.security
+ spring-security-config
+
+
+ org.hibernate.validator
+ hibernate-validator
+ 8.0.0.Final
+
+
+ jakarta.validation
+ jakarta.validation-api
+ 3.0.2
+
+
+ com.typesafe
+ config
+
+
+ dk.skat.rsu.b2b.sample
+ rsu-b2b-sample-client
+ ${project.version}
+
+
+ org.thymeleaf
+ thymeleaf
+ 3.1.1.RELEASE
+
+
+ org.thymeleaf
+ thymeleaf-spring6
+ 3.1.1.RELEASE
+
+
+ org.thymeleaf.extras
+ thymeleaf-extras-springsecurity6
+ 3.1.0.RELEASE
+
+
diff --git a/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/DownloadReceipt.java b/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/DownloadController.java
similarity index 55%
rename from rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/DownloadReceipt.java
rename to rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/DownloadController.java
index 0e690b0..d8c7757 100644
--- a/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/DownloadReceipt.java
+++ b/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/DownloadController.java
@@ -1,28 +1,19 @@
package dk.skat.rsu.b2b.sample.mvc;
import com.google.common.base.Strings;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
-/**
- * DownloadReceipt - Simple download servlet - Minimal efforts put into this.
- * However, it does name receipts by the transaction id - makes it easier to find
- * the receipt in the Download folder.
- *
- * @author SKAT
- * @since 1.0
- */
-public class DownloadReceipt extends HttpServlet {
+@Controller
+public class DownloadController {
- /**
- * Download receipt stored in memory.
- */
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
- String transactionId = request.getParameter("transactionId");
+ @GetMapping("/download/{transactionId}")
+ public void download(@PathVariable String transactionId, HttpServletResponse response) throws IOException {
if (Strings.isNullOrEmpty(transactionId)) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
@@ -41,6 +32,6 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
byte[] result = receipt.getReceipt();
out.write(result);
out.flush();
- }
+ }
}
diff --git a/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/LocalLogServlet.java b/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/LocalLogServlet.java
deleted file mode 100644
index 4af98f4..0000000
--- a/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/LocalLogServlet.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package dk.skat.rsu.b2b.sample.mvc;
-
-import org.apache.commons.io.IOUtils;
-
-import java.io.*;
-import java.util.logging.Logger;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import javax.servlet.http.HttpServlet;
-
-/**
- * LocalLogServlet - Just an endpoint to receive a SOAP POST on localhost.
- * The response cannot be processed by the sample clients, but will return
- * a soap fault.
- *
- * @author SKAT
- * @since 1.0
- */
-public class LocalLogServlet extends HttpServlet {
-
- private static final Logger LOGGER = Logger.getLogger(LocalLogServlet.class.getName());
-
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- // Set response content type
- response.setContentType("text/xml");
- String requestAsString = IOUtils.toString(request.getReader());
- LOGGER.info("Received request: " + requestAsString);
- String responseAsString = "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "env:Server\n" +
- "Request received, logged, but not processed. See logs for request submitted.\n" +
- "\n" +
- "\n" +
- "";
- PrintWriter out = response.getWriter();
- out.println(responseAsString);
- }
-}
diff --git a/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/ServiceTestAction.java b/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/ServiceTestAction.java
index bcd324e..195bc1d 100644
--- a/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/ServiceTestAction.java
+++ b/rsu-b2b-sample-client-gui/src/main/java/dk/skat/rsu/b2b/sample/mvc/ServiceTestAction.java
@@ -1,68 +1,53 @@
package dk.skat.rsu.b2b.sample.mvc;
-import com.opensymphony.xwork2.ActionSupport;
import dk.oio.rep.skat_dk.basis.kontekst.xml.schemas._2006._09._01.AdvisStrukturType;
import dk.oio.rep.skat_dk.basis.kontekst.xml.schemas._2006._09._01.FejlStrukturType;
-import dk.skat.rsu.b2b.sample.ModtagMomsangivelseForeloebigClient;
-import dk.skat.rsu.b2b.sample.MomsangivelseKvitteringHentClient;
-import dk.skat.rsu.b2b.sample.MomsangivelseKvitteringHentMarshalling;
-import dk.skat.rsu.b2b.sample.VirksomhedKalenderHentClient;
+import dk.oio.rep.skat_dk.basis.kontekst.xml.schemas._2006._09._01.HovedOplysningerSvarType;
+import dk.skat.rsu.b2b.sample.*;
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.Unmarshaller;
import oio.skat.nemvirksomhed.ws._1_0.ModtagMomsangivelseForeloebigOType;
import oio.skat.nemvirksomhed.ws._1_0.MomsangivelseKvitteringHentIType;
import oio.skat.nemvirksomhed.ws._1_0.MomsangivelseKvitteringHentOType;
+import oio.skat.nemvirksomhed.ws._1_0.VirksomhedKalenderHentOType;
import org.apache.commons.io.IOUtils;
-import org.apache.struts2.ServletActionContext;
+import org.springframework.binding.message.MessageBuilder;
+import org.springframework.binding.message.MessageContext;
import org.springframework.util.StringUtils;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.logging.Logger;
+import java.io.Serializable;
/**
* ServiceTestAction
*
* @author SKAT
* @since 1.0
*/
-public class ServiceTestAction extends ActionSupport {
+
+public class ServiceTestAction implements Serializable {
private static final Logger LOGGER = Logger.getLogger(ServiceTestAction.class.getName());
private ServiceTestForm serviceTestForm;
- private String serviceResponse;
-
- public String getServiceResponse() {
- return serviceResponse;
- }
-
- public void setServiceResponse(String serviceResponse) {
- this.serviceResponse = serviceResponse;
- }
-
- public ServiceTestForm getServiceTestForm() {
- return serviceTestForm;
- }
public void setServiceTestForm(ServiceTestForm serviceTestForm) {
this.serviceTestForm = serviceTestForm;
}
- public String init()
+ public TestResponse execute(ServiceTestForm serviceTestForm1, MessageContext context)
throws Exception {
- this.serviceTestForm = new ServiceTestForm();
- return SUCCESS;
- }
+ TestResponse testResponse = new TestResponse();
- @Override
- public String execute()
- throws Exception {
+ testResponse.setDeepLink("");
+ testResponse.setTransactionId("");
- if (serviceTestForm == null){
- this.serviceTestForm = new ServiceTestForm();
+ if (this.serviceTestForm == null) {
+ this.setServiceTestForm(serviceTestForm1);
}
LOGGER.info("Testing service : " + this.serviceTestForm.getService());
@@ -82,7 +67,6 @@ public String execute()
String requestAsString = this.serviceTestForm.getRequest();
String configurationPrefix = "endpoints." + environment + "." + service;
-
String serviceResponse = "";
try {
String endpoint = ConfigHelper.getConfiguration().getString(configurationPrefix);
@@ -94,19 +78,29 @@ public String execute()
if ("VirksomhedKalenderHent".equals(service)) {
VirksomhedKalenderHentClient client = new VirksomhedKalenderHentClient(endpoint, policy);
- serviceResponse = client.invoke(requestAsString, cert, this.serviceTestForm.isOverrideTxInfo());
+ VirksomhedKalenderHentOType out = client.invoke(requestAsString, cert, this.serviceTestForm.isOverrideTxInfo());
+ serviceResponse = VirksomhedKalenderHentMarshalling.toString(out);
+ if (out != null && out.getHovedOplysningerSvar() != null) {
+ addMessages(out.getHovedOplysningerSvar(), context);
+ }
}
if ("ModtagMomsangivelseForeloebig".equals(service)) {
ModtagMomsangivelseForeloebigClient client = new ModtagMomsangivelseForeloebigClient(endpoint, policy);
- serviceResponse = client.invoke(requestAsString, cert, this.serviceTestForm.isOverrideTxInfo());
+ ModtagMomsangivelseForeloebigOType out = client.invoke(requestAsString, cert, this.serviceTestForm.isOverrideTxInfo());
+ serviceResponse = ModtagMomsangivelseForeloebigMarshalling.toString(out);
+ if (out != null && out.getHovedOplysningerSvar() != null) {
+ addMessages(out.getHovedOplysningerSvar(), context);
+ }
+
// Get receipt and store PDF in memory for later download
InputStream inputStream = IOUtils.toInputStream(serviceResponse, "UTF-8");
JAXBContext jc = JAXBContext.newInstance(ModtagMomsangivelseForeloebigOType.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
ModtagMomsangivelseForeloebigOType asObject = (ModtagMomsangivelseForeloebigOType) unmarshaller.unmarshal(inputStream);
if (asObject.getDybtlink() != null) {
- addActionMessage("Confirm Link: " + asObject.getDybtlink().getUrlIndicator() + "");
+ testResponse.setDeepLink("Confirm Link: " + asObject.getDybtlink().getUrlIndicator() + "");
}
+
}
if ("MomsangivelseKvitteringHent".equals(service)) {
MomsangivelseKvitteringHentClient client = new MomsangivelseKvitteringHentClient(endpoint, policy);
@@ -119,27 +113,25 @@ public String execute()
MomsangivelseKvitteringHentIType requestAsObject = MomsangivelseKvitteringHentMarshalling.toObject(requestAsString);
String receiptTransactionId = requestAsObject.getTransaktionIdentifier();
- serviceResponse = client.invoke(requestAsString, cert, this.serviceTestForm.isOverrideTxInfo());
-
+ MomsangivelseKvitteringHentOType asObject = client.invoke(requestAsString, cert, this.serviceTestForm.isOverrideTxInfo());
+ serviceResponse = MomsangivelseKvitteringHentMarshalling.toString(asObject);
// Get receipt and store PDF in memory for later download
- InputStream inputStream = IOUtils.toInputStream(serviceResponse, "UTF-8");
- JAXBContext jc = JAXBContext.newInstance(MomsangivelseKvitteringHentOType.class);
- Unmarshaller unmarshaller = jc.createUnmarshaller();
- MomsangivelseKvitteringHentOType asObject = (MomsangivelseKvitteringHentOType) unmarshaller.unmarshal(inputStream);
-
- List