aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-04-08 15:31:10 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-04-08 15:31:10 +0200
commitabbc1e1576b9ac43f71aff6e4ca7697dcb12154a (patch)
tree3f34ed331f4c5b7140a9b32425b31b805114a44d
parent5975f5a96474dc129f282871f2d7d691cb0a52c9 (diff)
downloadmoa-zs-abbc1e1576b9ac43f71aff6e4ca7697dcb12154a.tar.gz
moa-zs-abbc1e1576b9ac43f71aff6e4ca7697dcb12154a.tar.bz2
moa-zs-abbc1e1576b9ac43f71aff6e4ca7697dcb12154a.zip
Update Codebase to Match MZS Schema Changes
- Important Fix: I forgot to annotate App2MzsService with @Service and autowire the App2MzsService object when creating the endpoint bean. For this reason, Spring did not autowire the dependencies in App2MzsService and I ended up with NullPointerExceptions in the testsuite. - Updated some more namespaces - Add objectFactory bean. objectfactory is autogenerated via the cxf-code-generation plugin, so i cannot annotate it with @Component or @Service. Alternative: create the @Bean by myself - Update the validDeliveryRequest SOAP Message to match the mzs 2.0.0 scheme.
-rw-r--r--src/main/java/at/gv/egiz/moazs/App2MzsService.java4
-rw-r--r--src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java10
-rw-r--r--src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java3
-rw-r--r--src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/formallyIncorrectDeliveryRequest.soap7
-rw-r--r--src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/validDeliveryRequest.soap98
5 files changed, 66 insertions, 56 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsService.java b/src/main/java/at/gv/egiz/moazs/App2MzsService.java
index a9c4302..2f06f7b 100644
--- a/src/main/java/at/gv/egiz/moazs/App2MzsService.java
+++ b/src/main/java/at/gv/egiz/moazs/App2MzsService.java
@@ -3,6 +3,7 @@ package at.gv.egiz.moazs;
import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs.App2MzsPortType;
import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.*;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
import javax.jws.WebParam;
import java.math.BigInteger;
@@ -12,11 +13,12 @@ import java.util.concurrent.TimeoutException;
import static java.util.concurrent.CompletableFuture.supplyAsync;
+@Service
public class App2MzsService implements App2MzsPortType {
//TODO move timeout to config
private final int timeoutForAnwser = 10;
- private final String MZSTNS = "http://reference.e-government.gv.at/namespace/moazs10/app2mzs#";
+ private final String MZSTNS = "http://reference.e-government.gv.at/namespace/zustellung/mzs/app2mzs#";
@Autowired
private DeliveryRequestHandler deliveryRequestHandler;
diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java b/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java
index 64e353d..578fecd 100644
--- a/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/App2MzsServiceConfig.java
@@ -1,5 +1,6 @@
package at.gv.egiz.moazs;
+import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.ObjectFactory;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,12 +15,19 @@ public class App2MzsServiceConfig {
@Autowired
private Bus bus;
+ @Autowired
+ private App2MzsService app2mzsService;
+
@Bean
public Endpoint endpoint() {
- EndpointImpl endpoint = new EndpointImpl(bus, new App2MzsService());
+ EndpointImpl endpoint = new EndpointImpl(bus, app2mzsService);
endpoint.setAddress("/");
endpoint.publish();
return endpoint;
}
+ @Bean
+ public ObjectFactory objectFactory() {
+ return new ObjectFactory();
+ }
}
diff --git a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
index 5879fa2..6874c75 100644
--- a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
+++ b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
@@ -45,8 +45,7 @@ public class App2MzsServiceTest {
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
logger.info("response.body was " + response.body());
logger.info("response.code was " + response.statusCode());
-
- //TODO Verify response
+ assertThat(response.statusCode()).isEqualTo(200);
}
diff --git a/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/formallyIncorrectDeliveryRequest.soap b/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/formallyIncorrectDeliveryRequest.soap
index bf38ab1..e8bd7f2 100644
--- a/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/formallyIncorrectDeliveryRequest.soap
+++ b/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/formallyIncorrectDeliveryRequest.soap
@@ -2,8 +2,8 @@
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:mzs="http://reference.e-government.gv.at/namespace/moazs10/app2mzs#"
- xmlns:p="http://reference.e-government.gv.at/namespace/persondata/20020228#"
+ xmlns:mzs="http://reference.e-government.gv.at/namespace/zustellung/mzs/app2mzs#"
+ xmlns:p="http://reference.e-government.gv.at/namespace/zustellung/mzs/persondata#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<mzs:DeliveryRequest>
@@ -47,6 +47,7 @@
</mzs:XMLContent>
<mzs:XMLProfileID>deckblatt</mzs:XMLProfileID>
</mzs:XMLDocument>
-</mzs:DeliveryRequest?>
+ <!-- I forgot to close DeliveryRequest -->
+<!-- </mzs:DeliveryRequest> -->
</soapenv:Body>
</soapenv:Envelope>
diff --git a/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/validDeliveryRequest.soap b/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/validDeliveryRequest.soap
index 662a161..91c0d61 100644
--- a/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/validDeliveryRequest.soap
+++ b/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/validDeliveryRequest.soap
@@ -1,52 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
- xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:mzs="http://reference.e-government.gv.at/namespace/moazs10/app2mzs#"
- xmlns:p="http://reference.e-government.gv.at/namespace/persondata/20020228#"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<soapenv:Body>
-<mzs:DeliveryRequest>
- <mzs:Sender>
- <mzs:ProfileID>SampleProfile2</mzs:ProfileID>
- <mzs:SignatureKeyID></mzs:SignatureKeyID>
- </mzs:Sender>
- <mzs:Receiver>
- <p:PhysicalPerson>
- <p:Name>
- <p:GivenName>Maxi</p:GivenName>
- <p:FamilyName>Mustermann1</p:FamilyName>
- </p:Name>
- <p:DateOfBirth>1984-01-24</p:DateOfBirth>
- </p:PhysicalPerson>
- <p:PostalAddress>
- <p:CountryCode>AT</p:CountryCode>
- <p:PostalCode>1010</p:PostalCode>
- <p:Municipality>Wien</p:Municipality>
- <p:DeliveryAddress>
- <p:StreetName>Muststrasse</p:StreetName>
- <p:BuildingNumber>10</p:BuildingNumber>
- </p:DeliveryAddress>
- </p:PostalAddress>
- </mzs:Receiver>
- <mzs:MetaData>
- <mzs:AppDeliveryID>asd</mzs:AppDeliveryID>
- <mzs:DeliveryQuality>nonRSa</mzs:DeliveryQuality>
- <mzs:RequiresEncryption>false</mzs:RequiresEncryption>
- </mzs:MetaData>
- <mzs:XMLDocument>
- <mzs:XMLContent>
- <message>
- <subject>Hello There!</subject>
- <body>
- <p>How are you</p>
- <p>Nice to hear from you!</p>
- <p>Regards, V</p>
- </body>
- </message>
- </mzs:XMLContent>
- <mzs:XMLProfileID>deckblatt</mzs:XMLProfileID>
- </mzs:XMLDocument>
-</mzs:DeliveryRequest>
-</soapenv:Body>
+ xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:mzs="http://reference.e-government.gv.at/namespace/zustellung/mzs/app2mzs#"
+ xmlns:p="http://reference.e-government.gv.at/namespace/zustellung/mzs/persondata#"
+ xmlns:msg="http://reference.e-government.gv.at/namespace/zustellung/msg/phase2/20181206#"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <soapenv:Body>
+ <mzs:DeliveryRequest>
+ <mzs:Sender>
+ <p:Authority>
+ <p:FullName>Bundesministerium für Testzwecke</p:FullName>
+ </p:Authority>
+ <mzs:WebserviceURL>https://authority.gv.at/delivery_notification</mzs:WebserviceURL>
+ </mzs:Sender>
+ <mzs:Receiver>
+ <p:PhysicalPerson>
+ <p:Name>
+ <p:GivenName>Maxi</p:GivenName>
+ <p:FamilyName>Mustermann1</p:FamilyName>
+ </p:Name>
+ <p:DateOfBirth>1984-01-24</p:DateOfBirth>
+ </p:PhysicalPerson>
+ <p:PostalAddress>
+ <p:CountryCode>AT</p:CountryCode>
+ <p:PostalCode>1010</p:PostalCode>
+ <p:Municipality>Wien</p:Municipality>
+ <p:DeliveryAddress>
+ <p:StreetName>Muststrasse</p:StreetName>
+ <p:BuildingNumber>10</p:BuildingNumber>
+ </p:DeliveryAddress>
+ </p:PostalAddress>
+ </mzs:Receiver>
+ <msg:MetaData>
+ <msg:AppDeliveryID>asd</msg:AppDeliveryID>
+ <msg:Subject>WichtigeMitteilung</msg:Subject>
+ <msg:DeliveryQuality>RSa</msg:DeliveryQuality>
+ </msg:MetaData>
+ <mzs:Payload>
+ <mzs:DocumentReference>https://authority.gv.at/files/73bdf969781ba41fa07df1ff8439cf685c0db1c3</mzs:DocumentReference>
+ <mzs:FileName>brief.xml</mzs:FileName>
+ <mzs:MIMEType>application/xml</mzs:MIMEType>
+ <msg:CheckSum>
+ <msg:AlgorithmID>SHA1</msg:AlgorithmID>
+ <msg:Value>9b972c70fdaf5e1b26b3387c87b0ffb72e5940b6</msg:Value>
+ </msg:CheckSum>
+ <mzs:Size>123401</mzs:Size>
+ </mzs:Payload>
+ </mzs:DeliveryRequest>
+ </soapenv:Body>
</soapenv:Envelope>