diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-05-09 15:41:19 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-05-09 16:13:54 +0200 |
commit | f27ff5780d98e747742140c526fb1e3469bb5748 (patch) | |
tree | 3787b02d2f4a4442d745632cc64259dd4954c47f /src/test/resources/at | |
parent | 4aed369467b2c6486de69ac767475fd305e0e068 (diff) | |
download | moa-zs-f27ff5780d98e747742140c526fb1e3469bb5748.tar.gz moa-zs-f27ff5780d98e747742140c526fb1e3469bb5748.tar.bz2 moa-zs-f27ff5780d98e747742140c526fb1e3469bb5748.zip |
Fix: Enable ApacheCXF's Automated Schema Validation
Problem: Apache CXF does not validate incoming mzs:DeliveryRequests
automatically. Per default, validation is off (performs better).
However, (1) we need to validate incoming requests, and (2)
automated CXF validation requires less maintenance and is
expected to be more stable than manual validation.
Solution:
- Add @SchemaValidation annotation to @Service.
- Endpoint Configuration: set WsdlLocation and ServiceName (needed
to prevent parser errors; see [1]).
Without those, CXF validates against generated classes and not
against the WSDL spec, and generated classes do not contain format
restrictions.
Add a testcase with an invalid delivery request ("rejectBothProfile-
AndCorporateBody") to ensure that the validator works.
[1] https://stackoverflow.com/questions/2231779/cxf-and-validation-schema-restrictions-ignored
Diffstat (limited to 'src/test/resources/at')
-rw-r--r-- | src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/profileAndCorporateBody.soap | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/profileAndCorporateBody.soap b/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/profileAndCorporateBody.soap new file mode 100644 index 0000000..3e52062 --- /dev/null +++ b/src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/profileAndCorporateBody.soap @@ -0,0 +1,59 @@ +<?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/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> + <msg:SenderProfile> + <msg:ProfileID>132456</msg:ProfileID> + </msg:SenderProfile> + <p:CorporateBody> + <p:Identification> + <p:Value>kkvj693+tw99uW8UPuEK9en1LzZItkylPajkUUyJJDWQB78VGPkAuhCEk+TD12yQDD/WRglsf+JfQpjubIs/4l/ptluJ9teF3nwkNlu5Dm7mIjzgW1qxrDyomCmPvVxTWOCBuMUbOWRZBhOq+KvDQAu9Vv9KnqSfjYeDZrpHYu4=</p:Value> + <p:Type>urn:publicid:gv:at:cemtoken</p:Type> + </p:Identification> + <p:FullName>Bundesministerium für Testzwecke</p:FullName> + </p:CorporateBody> + <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>valid-delivery-request-id</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>text/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> |