diff --git a/.gitignore b/.gitignore index f740e0f..9f27cac 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties .idea +*.iml +# Do not add: +run.sh \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index abd4127..7260e61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,3 +10,5 @@ jdk: script: - mvn --version + # Skip unit test in CI + - mvn clean install -Dmaven.test.skip=true diff --git a/README.md b/README.md index 6ca98fa..97bc350 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,184 @@ # EMCS B2B Sample Web Service Client written in Java -[![Build Status](https://travis-ci.com/skat/emcs-b2b-sample-ws-client-java.svg?token=pXpLRS1qCgHe3KVdbFyA&branch=master)](https://travis-ci.com/skat/emcs-b2b-sample-ws-client-java) +[![Build Status](https://travis-ci.com/skat/emcs-b2b-ws-sample-client-java.svg?token=pXpLRS1qCgHe3KVdbFyA&branch=master)](https://travis-ci.com/skat/emcs-b2b-ws-sample-client-java) Sample client for the EMCS B2B Web Service Gateway developed in Java and using open source libraries. + +**IMPORTANT NOTICE**: SKAT does not provide any kind of support for the code in this repository. +This Java-client is just one example of how a B2B web service can be accessed. The client must not be +perceived as a piece of production code but more as an example one can take inspiration from and can use +to quickly get started to test whether your company can implement a successful call to one of the B2B web +service using the company's digital signature. SKAT can not be held responsible if a company uses this client +or parts of it in their own systems. + +**VIGTIG MEDDELELSE**: SKAT yder ikke support på kildekoden i nærværende kodebibliotek. +Denne Java-klient er kun et eksempel på hvordan B2B webservicene kan tilgås. Klienten skal således ikke +opfattes som et stykke produktionskode men mere som en eksempel man kan lade sig inspirere af og kan bruge +til hurtigt at komme i gang og få afprøvet om ens virksomhed kan gennemføre et succesfuldt kald til en af +B2B webservicene ved at bruge virksomhedens digitale signatur. SKAT kan ikke stå til ansvar hvis en virksomhed +anvender klienten eller dele af denne i deres egne systemer. + +## About the client + +The sample client in 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 client currently implements calls to the service **OIOLedsageDocumentOpret** and the main entry +point into the source code of implementation is the class: + +[OIOLedsageDocumentOpretClient.java](src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java) + +This class constructs the request, invokes a Apache CXF generated client, and parses the response +by printing out relevant values to the log. + +## Fulfillment of WS Policy of EMCS Web Services + +The fulfillment of policies required to invoke EMCS B2B Web Services is configured in the file: + +[emcs-policy.xml](src/main/resources/emcs-policy.xml) + +Fulfillment of WS Policy requirements is achieved using CXF's in and out interceptor framework and +the `emcs-policy.xml` file details which parts are to be signed and encrypted, and how to present +certificate for authentication on the server side. This configuration file also demonstrates how +secure transport (https) is enabled client side. + +## Run client + +The sample client must be configured with two required parameters that are necessary for the client to run and +call the test environment of EMCS B2B Web Service Gateway. The two parameters can be obtained by contacting +SKAT Help Desk. + +The full list of parameters: + +* **dk.skat.emcs.b2b.sample.P12_PASSPHRASE** (REQUIRED): Passphrase to the certificate used for authentication, signing (request), and encryption (response). +* **dk.skat.emcs.b2b.sample.OIOLedsageDocumentOpret.ENDPOINT** (REQUIRED):The endpoint of the service being invoked. +* **dk.skat.emcs.b2b.sample.TXID_PREFIX** (OPTIONAL): This parameter sets a custom prefix to the generated transaction id and is very useful when asking SKAT Help Desk to trace a particular request. + +The client is then invoked as part of the **test phase** of the Maven build process that is run using the following +command line: + +```sh +$ mvn clean install \ + -Ddk.skat.emcs.b2b.sample.P12_PASSPHRASE= \ + -Ddk.skat.emcs.b2b.sample.OIOLedsageDocumentOpret.ENDPOINT= + -Ddk.skat.emcs.b2b.sample.TXID_PREFIX=ACME_01_ +``` + +The following is partial output of build and exhibits the request and response written +to the log: + +**Request**: +``` +Apr 12, 2017 11:07:23 AM dk.skat.emcs.b2b.sample.OIOLedsageDocumentOpretClient invoke +INFO: +******************************************************************* +** HovedOplysninger +**** Transaction Id: ACME_01_f57b8c74-31eb-482c-a481-966531930aea +**** Transaction Time: 2017-04-12T11:07:22.035+02:00 +** VirksomhedIdentifikationStruktur +**** AfgiftOperatoerPunktAfgiftIdentifikator: DK82065873300 +**** VirksomhedSENummerIdentifikator: 30808460 +******************************************************************* +``` + +**Response**: +``` +Apr 12, 2017 11:07:27 AM dk.skat.emcs.b2b.sample.OIOLedsageDocumentOpretClient invoke +INFO: +******************************************************************* +** HovedOplysningerSvar +**** Transaction Id: ACME_01_f57b8c74-31eb-482c-a481-966531930aea +**** Transaction Time: 2017-04-12T11:07:22.035+02:00 +**** Service Identification: FS2_OIOLedsageDokumentOpret +**** Error +****** Error Code: 494 +****** Error Text: Message identifier has been already used +******************************************************************* +``` + +In this particular output we see that the `ie815.xml` file has been sent in already. + +### Modifying the IE815 file to produce an ARC Id + +First ensure that the the following fields in the `ie815.xml` file are unique: + +* MessageIdentifier +* LocalReferenceNumber + +Then run the client again and the EMCS System will produce an ARC Identifier. + +**Sample response**: +``` +******************************************************************* +** HovedOplysningerSvar +**** Transaction Id: ACME_01_42166d20-65b5-4983-b7a2-9faec07abc54 +**** Transaction Time: 2017-04-24T13:43:52.146+02:00 +**** Service Identification: FS2_OIOLedsageDokumentOpret +Ledsagedokument Valideret Dato: 2017-04-24Z +Ledsagedokument ARC Identifikator: 17DKK1KHPMQH2W23ABI62 +******************************************************************* +``` + +## Advanced Configuration + +### Testing Expired and Revoked Certificates + +The client keystore includes three certificates: + +1. VOCES_gyldig.p12 with alias = `valid`. +2. VOCES_spaerret.p12 with alias = `revoked`. +3. VOCES_udloebet.p12 with alias = `expired`. + +By default the client is configured to run with certificate with alias `valid`. + +In order to complete a test with any of the other certificates the following files must be +changed: + +* File: **src/main/resources/etc/Client_Sign.properties** + +Change as described in the file itself: + +``` +# SKAT: Options = +# - valid (default) +# - revoked +# - expired +org.apache.ws.security.crypto.merlin.keystore.alias=revoked +``` + +File: **src/main/resources/emcs-policy.xml** + +Change as described in the file itself: + +``` + + +``` + +### Installing other OCESII Certificates in the client keystore + +The keystore `src/main/resources/keystore/client-keystore.jks` is already prepared with the +necessary test certificate that is authorized to access the test environment. However, in the +event that another test certificate has been issued this may be installed as follows: + +``` +$ export P12_PASSPHRASE=CHANGE_ME +$ export P12_CURRENT_ALIAS=CHANGE_ME +$ keytool -delete -alias valid -keystore src/main/resources/keystore/client-keystore.jks -storepass storepassword +$ keytool -changealias -keystore target/VOCES_yours.p12 -storepass $P12_PASSPHRASE -alias $P12_CURRENT_ALIAS -destalias "valid" +$ keytool -v -importkeystore -srckeystore target/VOCES_yours.p12 -srcstoretype PKCS12 -destkeystore src/main/resources/keystore/client-keystore.jks -deststoretype JKS -deststorepass storepassword -srcstorepass $P12_PASSPHRASE +``` + +Where `P12_PASSPHRASE` and `P12_CURRENT_ALIAS` are passphrase and alias of the OCESII certificate, +respectively. The three keytool command removes the pre configured certificate, changes the the alias +of the new certificate, and finally imports it into the keystore. + +## References + +* [Apache CXF](http://cxf.apache.org/) +* [Apache CXF Samples](https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples) diff --git a/build-client-keystore.sh b/build-client-keystore.sh new file mode 100755 index 0000000..53908ad --- /dev/null +++ b/build-client-keystore.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +CLIENT_KEYSTORE=src/main/resources/keystore/client-keystore.jks + +P12_PASSPHRASE=$1 + +echo "Provided p12 passphrase: $P12_PASSPHRASE" + +echo "Before import ..." +keytool -list -keystore $CLIENT_KEYSTORE -storepass storepassword + +echo "Importing ..." + +# Build target for processing p12 files before import +mkdir -p target +cp -r p12/*.p12 target + +# Import valid test certificate: VOCES_gyldig.p12 +# ----------------------------------------------- +# Change alias (not required by client) +keytool -changealias -keystore target/VOCES_gyldig.p12 -storepass $P12_PASSPHRASE -alias "nets danid a/s - tu voces gyldig" -destalias "valid" +keytool -v -importkeystore -srckeystore target/VOCES_gyldig.p12 -srcstoretype PKCS12 -destkeystore $CLIENT_KEYSTORE -deststoretype JKS -deststorepass storepassword -srcstorepass $P12_PASSPHRASE + +# Import revoked test certificate: VOCES_spaerret.p12 +# -------------------------------------------------- +# Change alias (required by client) +keytool -changealias -keystore target/VOCES_spaerret.p12 -storepass $P12_PASSPHRASE -alias "nets danid a/s - tu voces spærret" -destalias "revoked" +keytool -v -importkeystore -srckeystore target/VOCES_spaerret.p12 -srcstoretype PKCS12 -destkeystore $CLIENT_KEYSTORE -deststoretype JKS -deststorepass storepassword -srcstorepass $P12_PASSPHRASE + +# Import expired test certificate: VOCES_udloebet.p12 +# -------------------------------------------------- +# Change alias (required by client) +keytool -changealias -keystore target/VOCES_udloebet.p12 -storepass $P12_PASSPHRASE -alias "nets danid a/s - udløbet premexp1d1h" -destalias "expired" +keytool -v -importkeystore -srckeystore target/VOCES_udloebet.p12 -srcstoretype PKCS12 -destkeystore $CLIENT_KEYSTORE -deststoretype JKS -deststorepass storepassword -srcstorepass $P12_PASSPHRASE + +echo "After import ..." +keytool -list -keystore $CLIENT_KEYSTORE -storepass storepassword + +### Reverse imports +### NOT ACTIVE +# keytool -delete -alias valid -keystore src/main/resources/keystore/client-keystore.jks -storepass storepassword +# keytool -delete -alias revoked -keystore src/main/resources/keystore/client-keystore.jks -storepass storepassword +# keytool -delete -alias expired -keystore src/main/resources/keystore/client-keystore.jks -storepass storepassword + diff --git a/build-client-truststore.sh b/build-client-truststore.sh new file mode 100755 index 0000000..61c7cb1 --- /dev/null +++ b/build-client-truststore.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +CLIENT_TUSTSTORE=src/main/resources/keystore/client-truststore.jks + +echo "Before import ..." +keytool -list -keystore $CLIENT_TUSTSTORE -storepass storepassword + +echo "Importing ..." + +keytool -noprompt -import -alias skatserver -file pem/emcs-test-system.pem -keystore $CLIENT_TUSTSTORE -storepass storepassword + +# Import SSL cert for secure transport (https://..) +# The full cert. chain is viewable with openssl command: openssl s_client -connect host:port -showcerts +# +keytool -noprompt -import -alias ssl_chain_0 -file pem/ssl-chain-0.pem -keystore $CLIENT_TUSTSTORE -storepass storepassword +# Level 0 is sufficient for completeness we import the full chain (level 1,2,3)... +keytool -noprompt -import -alias ssl_chain_1 -file pem/ssl-chain-1.pem -keystore $CLIENT_TUSTSTORE -storepass storepassword +keytool -noprompt -import -alias ssl_chain_2 -file pem/ssl-chain-2.pem -keystore $CLIENT_TUSTSTORE -storepass storepassword +keytool -noprompt -import -alias ssl_chain_3 -file pem/ssl-chain-3.pem -keystore $CLIENT_TUSTSTORE -storepass storepassword + +echo "After import ..." +keytool -list -keystore $CLIENT_TUSTSTORE -storepass storepassword + +### Reverse imports +### NOT ACTIVE +# keytool -delete -alias skatserver -keystore src/main/resources/keystore/client-truststore.jks -storepass storepassword +# keytool -delete -alias ssl_chain_0 -keystore src/main/resources/keystore/client-truststore.jks -storepass storepassword +# keytool -delete -alias ssl_chain_1 -keystore src/main/resources/keystore/client-truststore.jks -storepass storepassword +# keytool -delete -alias ssl_chain_2 -keystore src/main/resources/keystore/client-truststore.jks -storepass storepassword +# keytool -delete -alias ssl_chain_3 -keystore src/main/resources/keystore/client-truststore.jks -storepass storepassword diff --git a/ie815.xml b/ie815.xml new file mode 100644 index 0000000..1904fda --- /dev/null +++ b/ie815.xml @@ -0,0 +1,109 @@ + + + + NDEA.DK + NDEA.DK + 2011-10-26 + 11:23:00.803 + 9e1e74a5-aaae-41d6-8280-c3892246e694 + + + + + 1 + + 1 + + + DK99025875300 + SEED selskab 1 test 2 + Kirkegade + 1 + 6840 + Oksbøl + + + DK82065873300 + Test af KS-1, testsitnr. 3.1.3.22 + Borupvej + 1 + 3320 + Skævinge + + + DK82065873309 + Test af KS-1, testsitnr. 3.1.3.22 + Borupvej + 9 + 3320 + Skævinge + + + DK99025875499 + SEED selskab 1 test 2 + Statshavnen + 6 + 3000 + Helsingør + + + DK008047 + + + TC10 + Lufthavnsvej + 8 + 2800 + Roskilde + + + 1 + H06 + 1 + + + 4 + + + 1 + + + 1 + W200 + 22042122 + 100 + 100 + 99 + 12 + Nix + 1 + Tjo + 4000000 + Nix + BB + + BJ + 10 + + + 2 + 1 + jajaja + + + + 1562594 + INV026594 + 2011-10-18 + 1 + 2011-10-26 + 02:00:00.814 + + + 1 + 299 + + + + diff --git a/p12/VOCES_gyldig.p12 b/p12/VOCES_gyldig.p12 new file mode 100644 index 0000000..f9fbd16 Binary files /dev/null and b/p12/VOCES_gyldig.p12 differ diff --git a/p12/VOCES_spaerret.p12 b/p12/VOCES_spaerret.p12 new file mode 100644 index 0000000..2a189ed Binary files /dev/null and b/p12/VOCES_spaerret.p12 differ diff --git a/p12/VOCES_udloebet.p12 b/p12/VOCES_udloebet.p12 new file mode 100644 index 0000000..8af58e1 Binary files /dev/null and b/p12/VOCES_udloebet.p12 differ diff --git a/pem/emcs-test-system.pem b/pem/emcs-test-system.pem new file mode 100644 index 0000000..066cee3 --- /dev/null +++ b/pem/emcs-test-system.pem @@ -0,0 +1,3 @@ +-----BEGIN CERTIFICATE----- +MIIGIDCCBQigAwIBAgIEUw9paTANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQGEwJESzESMBAGA1UECgwJVFJVU1QyNDA4MSQwIgYDVQQDDBtUUlVTVDI0MDggU3lzdGVtdGVzdCBYSVggQ0EwHhcNMTQxMTAzMTAzMTAyWhcNMTcxMTAzMTAzMDAzWjCBjjELMAkGA1UEBhMCREsxKjAoBgNVBAoMIVNrYXR0ZW1pbmlzdGVyaWV0IC8vIENWUjoxOTU1MjEwMTFTMCAGA1UEBRMZQ1ZSOjE5NTUyMTAxLVVJRDoyMTcyMTczMjAvBgNVBAMMKFNrYXR0ZW1pbmlzdGVyaWV0IC0gQjJCIGdhdGV3YXkgVFNFIFRFU1QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCO6MDX8l0SFNxZ3LZFX8+p88fWtdEL+r3nLQDESlOKlgBH+u7Rdzd/C8H0P0dQ8Zyq2mgFkWQ4vLR9nutaYsouPD8CVUn0hx7ZdKEpqIgeaI0Y2626rLiqJUinMdmch0Jmcjw70tKH6943QZTqxTr5BB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IwQYMBaAFMwCVQzkgXSvIFTVERRXnJFSOH+gMB0GA1UdDgQWBBQwJqW8ZNv6g1KoGHJY59UlgNBJ+TAJBgNVHRMEAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQBYHprbQhXLf17hhG3BlhqUB3drYpBNZRoePatKfqIbnkJKg9r5p3AN4vjDMxZCIJhLhE8FUjp5Up8DzpYShEDPHxAxSEvsaRXk6nencfunETDnLEvMryYZBADyTpKWPAV7rImhxILbqKpToFN+TjFaGQ6VNOu8ZrkZwwQAry2VAG1AGHbzHcCxQ3/mNpY+coeCeNM3w5URYFpwhJlZKDLBtXGLy7zBZROR5Pynq86FHLPCxb6hxmiM7V8ckgS6LOiTvIBaVyuIqFgQ/EYVlaXjbWDyFZBYnIsKLJGnw4muSPRsBCo4EKzPVhd8sjbVrh/sad2Jeta1Lzgyb5AG5AVm +-----END CERTIFICATE----- \ No newline at end of file diff --git a/pem/ssl-chain-0.pem b/pem/ssl-chain-0.pem new file mode 100644 index 0000000..ff039c2 --- /dev/null +++ b/pem/ssl-chain-0.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFZTCCBE2gAwIBAgIQXPzSoID5xbWfA5Ng5Q5rhzANBgkqhkiG9w0BAQsFADCB +kDELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNjA0BgNV +BAMTLUNPTU9ETyBSU0EgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBD +QTAeFw0xNDExMjEwMDAwMDBaFw0xNzEyMDkyMzU5NTlaMHkxITAfBgNVBAsTGERv +bWFpbiBDb250cm9sIFZhbGlkYXRlZDEiMCAGA1UECxMZSG9zdGVkIGJ5IENTQyBE +YW5tYXJrIEEvUzEcMBoGA1UECxMTQ09NT0RPIFNTTCBXaWxkY2FyZDESMBAGA1UE +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oZIhvcNAQELBQADggEBAGrrtRB2r12Ap6rakDvbkZKgQziirVg9 +zozlNeeYYDPcPPuCrFgJ8CEQnurC7pcKMdcSBqViYL7AfHCwlEDbNmvsz8fEY+Cl +sR01HzPz3OJq3x21aVJzJy2gUX8QgvkvZkMGKYbEpSC1F3IUc/nEJJvfGBFPQQf9 +acTp9aQcxUs+0V+VdbSK2ks1mLvr+qml0dm/8e/rCYxALMJREpYQH4eQZuTUD/hJ +44WvhLHQAc/aLHmaGIwZOcMLU3+cap7qcVznjC1XC0ZQ9rgLqER4boewtT7XnSs6 +ONNJH+H2UwoESE6X1wtfB02xwI5uX/f3x/btIm7DsJVaUXTavnqPwX4= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/pem/ssl-chain-1.pem b/pem/ssl-chain-1.pem new file mode 100644 index 0000000..d81d72a --- /dev/null +++ b/pem/ssl-chain-1.pem @@ -0,0 +1,35 @@ +-----BEGIN CERTIFICATE----- +MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB +hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV +BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMjEy +MDAwMDAwWhcNMjkwMjExMjM1OTU5WjCBkDELMAkGA1UEBhMCR0IxGzAZBgNVBAgT +EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR +Q09NT0RPIENBIExpbWl0ZWQxNjA0BgNVBAMTLUNPTU9ETyBSU0EgRG9tYWluIFZh +bGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAI7CAhnhoFmk6zg1jSz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XdoltMY +dVEVABt0iN3hxzgEQyjpFv3ZBdRdRydg1vs4O2xyopT4Qhrf7W8GjEXCBgCq5Ojc +2bXhc3js9iPc0d1sjhqPpepUfJa3w/5Vjo1JXvxku88+vZbrac2/4EjxYoIQ5QxG +V/Iz2tDIY+3GH5QFlkoakdH368+PUq4NCNk+qKBR6cGHdNXJ93SrLlP7u3r7l+L4 +HyaPs9Kg4DdbKDsx5Q5XLVq4rXmsXiBmGqW5prU5wfWYQ//u+aen/e7KJD2AFsQX +j4rBYKEMrltDR5FL1ZoXX/nUh8HCjLfn4g8wGTeGrODcQgPmlKidrv0PJFGUzpII +0fxQ8ANAe4hZ7Q7drNJ3gjTcBpUC2JD5Leo31Rpg0Gcg19hCC0Wvgmje3WYkN5Ap +lBlGGSW4gNfL1IYoakRwJiNiqZ+Gb7+6kHDSVneFeO/qJakXzlByjAA6quPbYzSf ++AZxAeKCINT+b72x +-----END CERTIFICATE----- diff --git a/pem/ssl-chain-2.pem b/pem/ssl-chain-2.pem new file mode 100644 index 0000000..80b05dc --- /dev/null +++ b/pem/ssl-chain-2.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFdDCCBFygAwIBAgIQJ2buVutJ846r13Ci/ITeIjANBgkqhkiG9w0BAQwFADBv +MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk +ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF +eHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFow +gYUxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO +BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMSswKQYD +VQQDEyJDT01PRE8gUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR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Y3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggEBAGS/g/FfmoXQ +zbihKVcN6Fr30ek+8nYEbvFScLsePP9NDXRqzIGCJdPDoCpdTPW6i6FtxFQJdcfj +Jw5dhHk3QBN39bSsHNA7qxcS1u80GH4r6XnTq1dFDK8o+tDb5VCViLvfhVdpfZLY +Uspzgb8c8+a4bmYRBbMelC1/kZWSWfFMzqORcUx8Rww7Cxn2obFshj5cqsQugsv5 +B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9Hvx +PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR +pu/xO28QOG8= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/pem/ssl-chain-3.pem b/pem/ssl-chain-3.pem new file mode 100644 index 0000000..cf8f0da --- /dev/null +++ b/pem/ssl-chain-3.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs +IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 +MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux +FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h +bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v +dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt +H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 +uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX +mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX +a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN +E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 +WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD +VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 +Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU +cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx +IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN +AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH +YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 +6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC +Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX +c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a +mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a2880c4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,113 @@ + + 4.0.0 + dk.skat.emcs.b2b.sample + emcs-b2b-ws-sample-client-java + jar + 1.0 + emcs-b2b-ws-sample-client-java + http://www.skat.dk/emcs + + 3.1.9 + 4.1.9.RELEASE + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf.version} + + + org.apache.cxf + cxf-rt-transports-http + ${cxf.version} + + + org.apache.cxf + cxf-rt-transports-http-jetty + ${cxf.version} + + + org.apache.cxf + cxf-rt-ws-security + ${cxf.version} + + + org.apache.cxf + cxf-rt-ws-policy + ${cxf.version} + + + org.springframework + spring-core + ${cxf.spring.version} + + + org.springframework + spring-beans + ${cxf.spring.version} + + + org.springframework + spring-context + ${cxf.spring.version} + + + org.slf4j + jcl-over-slf4j + 1.7.22 + + + junit + junit + 4.12 + test + + + + + + + org.apache.cxf + cxf-codegen-plugin + 3.1.9 + + + generate-sources + generate-sources + + ${project.build.directory}/generated/cxf + + + ${basedir}/src/main/resources/OIOLedsageDokumentOpret/OIOLedsageDokumentOpret.wsdl + + + + + wsdl2java + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + target/generated/cxf + + + + + + + + diff --git a/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java b/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java new file mode 100644 index 0000000..5b985c3 --- /dev/null +++ b/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java @@ -0,0 +1,165 @@ +package dk.skat.emcs.b2b.sample; + +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.oio.rep.skat_dk.basis.kontekst.xml.schemas._2006._09._01.HovedOplysningerType; +import oio.skat.emcs.ws._1_0.IE815StrukturType; +import oio.skat.emcs.ws._1_0.OIOLedsageDokumentOpretIType; +import oio.skat.emcs.ws._1_0.OIOLedsageDokumentOpretOType; +import oio.skat.emcs.ws._1_0.VirksomhedIdentifikationStrukturType; +import oio.skat.emcs.ws._1_0_1.OIOLedsageDokumentOpretService; +import oio.skat.emcs.ws._1_0_1.OIOLedsageDokumentOpretServicePortType; +import oio.skat.emcs.ws._1_0.VirksomhedIdentifikationStrukturType.Indberetter; +import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; +import org.apache.cxf.bus.spring.SpringBusFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.ws.BindingProvider; +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.logging.Logger; + +/** + * OIOLedsageDocumentOpretClient + * + * @author SKAT + * @since 1.0 + */ +@SuppressWarnings("ALL") +public class OIOLedsageDocumentOpretClient { + + private static final Logger LOGGER = Logger.getLogger(OIOLedsageDocumentOpretClient.class.getName()); + + private String endpointURL; + + /** + * Private constructor + */ + private OIOLedsageDocumentOpretClient() { + } + + /** + * Constructor + * + * @param endpointURL Endpoint of OIOLedsageDocumentOpret service + */ + public OIOLedsageDocumentOpretClient(String endpointURL) { + this.endpointURL = endpointURL; + } + + /** + * Call OIOLedsageDocumentOpret service + * + * @param virksomhedSENummerIdentifikator VAT number of entity calling entity + * @param afgiftOperatoerPunktAfgiftIdentifikator Excise Number of calling entity + * @param ie815 IE815 document file path. + * @throws DatatypeConfigurationException N/A + * @throws ParserConfigurationException N/A + * @throws IOException N/A + * @throws SAXException N/A + */ + public void invoke(String virksomhedSENummerIdentifikator, + String afgiftOperatoerPunktAfgiftIdentifikator, + String ie815) throws DatatypeConfigurationException, ParserConfigurationException, IOException, SAXException { + + final String newLine = System.getProperty("line.separator"); + + // Generate Transaction Id + final String transactionID = TransactionIdGenerator.getTransactionId(); + + // Generate Transaction Time + GregorianCalendar gregorianCalendar = new GregorianCalendar(); + gregorianCalendar.setTime(new Date()); + XMLGregorianCalendar transactionTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); + + // Build HovedOplysninger Object and set transaction id and time + HovedOplysningerType hovedOplysningerType = new HovedOplysningerType(); + hovedOplysningerType.setTransaktionIdentifikator(transactionID); + hovedOplysningerType.setTransaktionTid(transactionTime); + + // Build VirksomhedIdentifikationStruktur + VirksomhedIdentifikationStrukturType virksomhedIdentifikationStrukturType = new VirksomhedIdentifikationStrukturType(); + virksomhedIdentifikationStrukturType.setAfgiftOperatoerPunktAfgiftIdentifikator(afgiftOperatoerPunktAfgiftIdentifikator); + Indberetter indberetter = new Indberetter(); + indberetter.setVirksomhedSENummerIdentifikator(virksomhedSENummerIdentifikator); + virksomhedIdentifikationStrukturType.setIndberetter(indberetter); + + // Load IE815 document + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + File file = new File(ie815); + Document doc = db.parse(file); + + // Build IE815StrukturType + IE815StrukturType ie815StrukturType = new IE815StrukturType(); + // Set ie815 document + ie815StrukturType.setAny(doc.getDocumentElement()); + + OIOLedsageDokumentOpretIType oioLedsageDokumentOpretIType = new OIOLedsageDokumentOpretIType(); + oioLedsageDokumentOpretIType.setHovedOplysninger(hovedOplysningerType); + oioLedsageDokumentOpretIType.setVirksomhedIdentifikationStruktur(virksomhedIdentifikationStrukturType); + oioLedsageDokumentOpretIType.setIE815Struktur(ie815StrukturType); + + Bus bus = new SpringBusFactory().createBus("emcs-policy.xml", false); + BusFactory.setDefaultBus(bus); + + OIOLedsageDokumentOpretService service = new OIOLedsageDokumentOpretService(); + OIOLedsageDokumentOpretServicePortType port = service.getOIOLedsageDokumentOpretServicePort(); + + // Set endpoint of service. + BindingProvider bp = (BindingProvider)port; + bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, this.endpointURL); + + StringBuilder sbRequest = new StringBuilder(); + sbRequest.append("*******************************************************************").append(newLine); + sbRequest.append("** HovedOplysninger").append(newLine); + sbRequest.append("**** Transaction Id: ").append(oioLedsageDokumentOpretIType.getHovedOplysninger().getTransaktionIdentifikator()).append(newLine); + sbRequest.append("**** Transaction Time: ").append(oioLedsageDokumentOpretIType.getHovedOplysninger().getTransaktionTid()).append(newLine); + sbRequest.append("** VirksomhedIdentifikationStruktur").append(newLine); + sbRequest.append("**** AfgiftOperatoerPunktAfgiftIdentifikator: ").append(oioLedsageDokumentOpretIType.getVirksomhedIdentifikationStruktur().getAfgiftOperatoerPunktAfgiftIdentifikator()).append(newLine); + sbRequest.append("**** VirksomhedSENummerIdentifikator: ").append(oioLedsageDokumentOpretIType.getVirksomhedIdentifikationStruktur().getIndberetter().getVirksomhedSENummerIdentifikator()).append(newLine); + sbRequest.append("*******************************************************************").append(newLine); + LOGGER.info(newLine + sbRequest.toString()); + + + OIOLedsageDokumentOpretOType out = port.getOIOLedsageDokumentOpret(oioLedsageDokumentOpretIType); + StringBuilder sb = new StringBuilder(); + sb.append("*******************************************************************").append(newLine); + sb.append("** HovedOplysningerSvar").append(newLine); + sb.append("**** Transaction Id: ").append(out.getHovedOplysningerSvar().getTransaktionIdentifikator()).append(newLine); + sb.append("**** Transaction Time: ").append(out.getHovedOplysningerSvar().getTransaktionTid()).append(newLine); + sb.append("**** Service Identification: ").append(out.getHovedOplysningerSvar().getServiceIdentifikator()).append(newLine); + if (out.getHovedOplysningerSvar().getSvarStruktur().getAdvisStrukturOrFejlStruktur().size() > 0) { + for (Object errorOrAdvis : out.getHovedOplysningerSvar().getSvarStruktur().getAdvisStrukturOrFejlStruktur()) { + if (errorOrAdvis instanceof FejlStrukturType) { + FejlStrukturType fejlStrukturType = (FejlStrukturType) errorOrAdvis; + sb.append("**** Error").append(newLine); + sb.append("****** Error Code: ").append(fejlStrukturType.getFejlIdentifikator()).append(newLine); + sb.append("****** Error Text: ").append(fejlStrukturType.getFejlTekst()).append(newLine); + } + if (errorOrAdvis instanceof AdvisStrukturType) { + AdvisStrukturType advisStrukturType = (AdvisStrukturType) errorOrAdvis; + sb.append("**** Advis").append(newLine); + sb.append("****** Advis Code: ").append(advisStrukturType.getAdvisIdentifikator()).append(newLine); + sb.append("****** Advis Text: ").append(advisStrukturType.getAdvisTekst()).append(newLine); + } + } + } else { + sb.append("Ledsagedokument Valideret Dato: ").append(out.getOutput().getLedsageDokument().getLedsagedokumentValideretDato().toString()).append(newLine); + sb.append("Ledsagedokument ARC Identifikator: ").append(out.getOutput().getLedsageDokument().getLedsagedokumentARCIdentifikator()).append(newLine); + } + sb.append("*******************************************************************").append(newLine); + + LOGGER.info(newLine + sb.toString()); + } + +} diff --git a/src/main/java/dk/skat/emcs/b2b/sample/TransactionIdGenerator.java b/src/main/java/dk/skat/emcs/b2b/sample/TransactionIdGenerator.java new file mode 100644 index 0000000..d38d76c --- /dev/null +++ b/src/main/java/dk/skat/emcs/b2b/sample/TransactionIdGenerator.java @@ -0,0 +1,33 @@ +package dk.skat.emcs.b2b.sample; + +import java.util.UUID; + +/** + * TransactionIdGenerator + * + * @author SKAT + * @since 1.0 + */ +public class TransactionIdGenerator { + + /** + * Generate transaction id. + * + * If JVM parameter -Ddk.skat.emcs.b2b.sample.TXID_PREFIX=SOMETHING has been set generated transaction + * id will be prefix with 'SOMETHING'. This feature is designed to make + * diagnostics server side easier when searching the logs. + * + * @return Transaction id (possible prefixed) + */ + public static final String getTransactionId() { + final String prefix = System.getProperty("dk.skat.emcs.b2b.sample.TXID_PREFIX"); + String transactionId = UUID.randomUUID().toString(); + if (prefix != null) { + transactionId = prefix + transactionId; + } + return transactionId; + } + + private TransactionIdGenerator() { + } +} diff --git a/src/main/java/dk/skat/emcs/b2b/sample/UTPasswordCallback.java b/src/main/java/dk/skat/emcs/b2b/sample/UTPasswordCallback.java new file mode 100644 index 0000000..2dfd84e --- /dev/null +++ b/src/main/java/dk/skat/emcs/b2b/sample/UTPasswordCallback.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dk.skat.emcs.b2b.sample; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.wss4j.common.ext.WSPasswordCallback; + +/** + * UTPasswordCallback + * + * @author SKAT + * @since 1.0 + */ +public class UTPasswordCallback implements CallbackHandler { + + private Map passwords = + new HashMap(); + + public UTPasswordCallback() { + String P12_PASSPHRASE = System.getProperty("dk.skat.emcs.b2b.sample.P12_PASSPHRASE"); + passwords.put("valid", P12_PASSPHRASE); + passwords.put("revoked", P12_PASSPHRASE); + passwords.put("expired", P12_PASSPHRASE); + } + + /** + * Here, we attempt to get the password from the private + * alias/passwords map. + */ + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + WSPasswordCallback pc = (WSPasswordCallback) callbacks[i]; + + String pass = passwords.get(pc.getIdentifier()); + if (pass != null) { + pc.setPassword(pass); + return; + } + } + } + + /** + * Add an alias/password pair to the callback mechanism. + */ + public void setAliasPassword(String alias, String password) { + passwords.put(alias, password); + } +} diff --git a/src/main/resources/OIOLedsageDokumentOpret/OIOLedsageDokumentOpret.wsdl b/src/main/resources/OIOLedsageDokumentOpret/OIOLedsageDokumentOpret.wsdl new file mode 100755 index 0000000..0a048c3 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/OIOLedsageDokumentOpret.wsdl @@ -0,0 +1,40 @@ + + + + OIO-udgave af tilsvarende forretningsservice. Sætter eksterne afsendere i stand til at sende et nyt ledsagedokument til validering. Servicen returnere ARC-nummeret samt valideringsdatoen på det elektroniske ledsagedokument. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/OIOLedsageDokumentOpret/cvr_dk/xml/schemas/2005/03/22/CVRnumberIdentifier.xsd b/src/main/resources/OIOLedsageDokumentOpret/cvr_dk/xml/schemas/2005/03/22/CVRnumberIdentifier.xsd new file mode 100755 index 0000000..33981b4 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/cvr_dk/xml/schemas/2005/03/22/CVRnumberIdentifier.xsd @@ -0,0 +1,16 @@ + + + + + Unique and generally usable identifier for + all legal units included i CVR. + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisIdentifikator.xsd new file mode 100755 index 0000000..2ea454f --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisIdentifikator.xsd @@ -0,0 +1,15 @@ + + + + + + Element til at identificere en + forretningsmæssig advis fra et servicekald. Elementet er + typisk en kode hvis aktuelle betydning er en del af + beskrivelsen af funktionaliteten for den enkelte service. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisStruktur.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisStruktur.xsd new file mode 100755 index 0000000..3f73de8 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisStruktur.xsd @@ -0,0 +1,26 @@ + + + + + + + Et dokumentfragment med denne struktur + beskriver en enkelt forretningsmæssig advisering i + svaret fra en webservice. Adviseringen består i en + identifikator for advisen samt en advisbeskrivelse der + kan have specifikt forretningsmæssigt indhold. De + forventelige værdierne i denne struktur er en del af + kontrakten for de enkelte services som AdvisStruktur + indgår i. + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisTekst.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisTekst.xsd new file mode 100755 index 0000000..79d45cf --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/AdvisTekst.xsd @@ -0,0 +1,14 @@ + + + + + + Element til at beskrive en + forretningsmæssig advis fra et servicekald. Indholdet er + typisk en tekst der beskriver en advarsel fra en service. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlIdentifikator.xsd new file mode 100755 index 0000000..737e245 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlIdentifikator.xsd @@ -0,0 +1,17 @@ + + + + + Element til at identificere en + forretningsmæssig fejl fra et servicekald. Elementet er + typisk en kode hvis aktuelle betydning er en del af + beskrivelsen af funktionaliteten for den enkelte service. + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlStruktur.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlStruktur.xsd new file mode 100755 index 0000000..cf30c46 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlStruktur.xsd @@ -0,0 +1,25 @@ + + + + + + + Et dokumentfragment med denne struktur + beskriver en enkelt forretningsmæssig fejl i svaret fra + en webservice. Fejlen består i en identifikator for + fejlen samt en fejlbeskrivelse der kan have specifikt + forretningsmæssigt indhold. De forventelige værdierne i + denne struktur er en del af kontrakten for de enkelte + services som FejlStruktur indgår i. + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlTekst.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlTekst.xsd new file mode 100755 index 0000000..fccdd20 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/FejlTekst.xsd @@ -0,0 +1,19 @@ + + + + + Element til at beskrive en + forretningsmæssig fejl fra et servicekald. Indholdet er + typisk en tekst der beskriver en forretningsmæssig fejl + opstået i en service. + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/HovedOplysninger.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/HovedOplysninger.xsd new file mode 100755 index 0000000..c95c0ac --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/HovedOplysninger.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/HovedOplysningerSvar.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/HovedOplysningerSvar.xsd new file mode 100755 index 0000000..adcaff9 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/HovedOplysningerSvar.xsd @@ -0,0 +1,48 @@ + + + + Strukturen er en generisk svarmekanisme til at + udveksle forretningsmæssige fejl og adviser med et + modsvarende system. Strukturen forudsætter ikke nogen + servicespecifk viden, udover at navnet på den konkrete + service skal stå i feltet ServiceIndikator. De fejl og + adviser der rapporteres med strukturen skal betragtes som + unikt identificeret af + ServiceIdentifikator+FejlIdentifikator henholdsvis + ServiceIdentifikator+AdvisIdentifikator. Herved kan + forskellige services benytte overlappende serier af + identifikatorer og stadigvæk være unikt identificeret. + + + + + + + + + Strukturen er en generisk svarmekanisme + til at udveksle forretningsmæssige fejl og adviser med + et modsvarende system. Strukturen forudsætter ikke + nogen servicespecifk viden, udover at navnet på den + konkrete service skal stå i feltet ServiceIndikator. De + fejl og adviser der rapporteres med strukturen skal + betragtes som unikt identificeret af + ServiceIdentifikator+FejlIdentifikator henholdsvis + ServiceIdentifikator+AdvisIdentifikator. Herved kan + forskellige services benytte overlappende serier af + identifikatorer og stadigvæk være unikt identificeret. + + + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/ServiceIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/ServiceIdentifikator.xsd new file mode 100755 index 0000000..663c70b --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/ServiceIdentifikator.xsd @@ -0,0 +1,14 @@ + + + + + Element til at identificere den service + der svarer. Dens værdi skal antage navnet på den service + der svarer. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/SvarStruktur.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/SvarStruktur.xsd new file mode 100755 index 0000000..a53230b --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/SvarStruktur.xsd @@ -0,0 +1,22 @@ + + + + + + + Valg mellem et antal forretningsmæssige + adviser og fejl der kan returneres fra en service. Der + kan rapporteres et ubegrænset antal af begge dele i en + vilkårlig orden. + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/TransaktionIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/TransaktionIdentifikator.xsd new file mode 100755 index 0000000..530c2ea --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/TransaktionIdentifikator.xsd @@ -0,0 +1,28 @@ + + + + + Felt der giver kalder af service mulighed + for at binde sit eget transaktionsspor sammen med den + kaldte webservice. Når brug af dette felt understøttes + af en service, så vil værdier af en + TransaktionIdentifikator der gives ved et kald af + service blive returneret ved svar fra samme service. Der + er ikke nogen bindinger på hvordan + TransaktionsIdentifikatoren skal udformes, men det er + hensigten at det kaldende system selv skal administrere + anvendelsen af unikke identifikationer af sine kald, så + svar kan matches til kald. + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/TransaktionTid.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/TransaktionTid.xsd new file mode 100755 index 0000000..b1280d2 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/basis/kontekst/xml/schemas/2006/09/01/TransaktionTid.xsd @@ -0,0 +1,21 @@ + + + + + Felt der giver kalder af service mulighed + for at tidsstemple sit eget transaktionsspor uafhængigt + af kaldte systems interne tid. Når brug af dette felt + understøttes af en service, så vil værdier af en + TransaktionTid der gives ved et kald af service blive + returneret ved svar fra samme service. Der er ikke nogen + bindinger på hvordan TransaktionTid skal udformes, + udover at det er et xs:dateTime, men det er hensigten at + det kaldende system kan anvende tidsstempel til hurtigt + at kunne udsøge servicekald i egne loggingmekanismer. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/emcs/class/ledsagedokument/xml/schemas/20080301/LedsagedokumentValideretDato.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/emcs/class/ledsagedokument/xml/schemas/20080301/LedsagedokumentValideretDato.xsd new file mode 100755 index 0000000..242f40c --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/emcs/class/ledsagedokument/xml/schemas/20080301/LedsagedokumentValideretDato.xsd @@ -0,0 +1,10 @@ + + + + + Dato hvor ledsagedokumentet er valideret. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/skat_dk/motor/class/virksomhed/xml/schemas/20080401/VirksomhedSENummerIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/motor/class/virksomhed/xml/schemas/20080401/VirksomhedSENummerIdentifikator.xsd new file mode 100755 index 0000000..3592e79 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/skat_dk/motor/class/virksomhed/xml/schemas/20080401/VirksomhedSENummerIdentifikator.xsd @@ -0,0 +1,14 @@ + + + + + + 8-cifret nummer, der entydigt identificerer + en registreret virksomhed i SKAT. Indhold: 8-cifret + nummer, der entydigt identificerer en registreret + virksomhed i SKAT. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/AfgiftOperatoerPunktAfgiftIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/AfgiftOperatoerPunktAfgiftIdentifikator.xsd new file mode 100755 index 0000000..5fa5280 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/AfgiftOperatoerPunktAfgiftIdentifikator.xsd @@ -0,0 +1,12 @@ + + + + + Benyttes til at entydigt identificere en + EU virksomhed eller en midlertidigt registreret virksomhed. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/IE917BeskedTekst.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/IE917BeskedTekst.xsd new file mode 100755 index 0000000..8d453c5 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/IE917BeskedTekst.xsd @@ -0,0 +1,11 @@ + + + + + IE 917 Message repræsenteret som tekst + (EN: IE message as text) + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/LedsagedokumentARCIdentifikator.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/LedsagedokumentARCIdentifikator.xsd new file mode 100755 index 0000000..9abcec7 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/1_0_1/LedsagedokumentARCIdentifikator.xsd @@ -0,0 +1,16 @@ + + + + + En entydig kode som identificerer et + elektronisk ledsagedokument (ARC = Administrative + Reference Code) Indhold: Nummeret er opbygget af + årstal, fx "05", landekode "DK", en + unik kode på 16 karakterer, samt en kontrol kode på et + tal. + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/IE815Struktur.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/IE815Struktur.xsd new file mode 100755 index 0000000..8a4798b --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/IE815Struktur.xsd @@ -0,0 +1,15 @@ + + + + IE815 Message struktur + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpretInterface.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpretInterface.xsd new file mode 100755 index 0000000..eeeb6cf --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpretInterface.xsd @@ -0,0 +1,21 @@ + + + + OIO-udgave af tilsvarende forretningsservice. + Sætter eksterne afsendere i stand til at sende et nyt + ledsagedokument til validering. Servicen returnere + ARC-nummeret samt valideringsdatoen på det elektroniske ledsagedokument. + + + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpret_I.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpret_I.xsd new file mode 100755 index 0000000..2c4e060 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpret_I.xsd @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpret_O.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpret_O.xsd new file mode 100755 index 0000000..d0267d4 --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/OIOLedsageDokumentOpret_O.xsd @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/VirksomhedIdentifikationStruktur.xsd b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/VirksomhedIdentifikationStruktur.xsd new file mode 100755 index 0000000..b3907bc --- /dev/null +++ b/src/main/resources/OIOLedsageDokumentOpret/urn/oio/skat/emcs/ws/1_0_1/VirksomhedIdentifikationStruktur.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/emcs-policy.xml b/src/main/resources/emcs-policy.xml new file mode 100644 index 0000000..abe7e11 --- /dev/null +++ b/src/main/resources/emcs-policy.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + .*_EXPORT_.* + .*_EXPORT1024_.* + .*_WITH_DES_.* + .*_WITH_AES_.* + .*_WITH_NULL_.* + .*_DH_anon_.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/etc/Client_Encrypt.properties b/src/main/resources/etc/Client_Encrypt.properties new file mode 100644 index 0000000..54badfe --- /dev/null +++ b/src/main/resources/etc/Client_Encrypt.properties @@ -0,0 +1,6 @@ +org.apache.ws.security.crypto.provider=org.apache.wss4j.common.crypto.Merlin +org.apache.ws.security.crypto.merlin.keystore.type=jks +org.apache.ws.security.crypto.merlin.keystore.password=storepassword +# SKAT: This is the certificate used for the encryption: +org.apache.ws.security.crypto.merlin.keystore.alias=skatserver +org.apache.ws.security.crypto.merlin.keystore.file=keystore/client-truststore.jks diff --git a/src/main/resources/etc/Client_Sign.properties b/src/main/resources/etc/Client_Sign.properties new file mode 100644 index 0000000..edabb49 --- /dev/null +++ b/src/main/resources/etc/Client_Sign.properties @@ -0,0 +1,10 @@ +org.apache.ws.security.crypto.provider=org.apache.wss4j.common.crypto.Merlin +org.apache.ws.security.crypto.merlin.keystore.type=jks +org.apache.ws.security.crypto.merlin.keystore.password=storepassword +# SKAT: Options = +# - valid (default) +# - revoked +# - expired +org.apache.ws.security.crypto.merlin.keystore.alias=valid +org.apache.ws.security.crypto.merlin.keystore.file=keystore/client-keystore.jks + diff --git a/src/main/resources/keystore/client-keystore.jks b/src/main/resources/keystore/client-keystore.jks new file mode 100644 index 0000000..2fa296c Binary files /dev/null and b/src/main/resources/keystore/client-keystore.jks differ diff --git a/src/main/resources/keystore/client-truststore.jks b/src/main/resources/keystore/client-truststore.jks new file mode 100644 index 0000000..c3dcd8e Binary files /dev/null and b/src/main/resources/keystore/client-truststore.jks differ diff --git a/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java b/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java new file mode 100644 index 0000000..c9594fb --- /dev/null +++ b/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java @@ -0,0 +1,31 @@ +package dk.skat.emcs.b2b.sample; + +import org.junit.Test; + +/** + * OIOLedsageDocumentOpretClient Test + * + * @author SKAT + * @since 1.0 + */ +public class OIOLedsageDocumentOpretClientTest { + + @Test + public void invoke() throws Exception { + String endpointURL = + System.getProperty("dk.skat.emcs.b2b.sample.OIOLedsageDocumentOpret.ENDPOINT"); + + // Path to where the IE815 document is located + String ie815 = "ie815.xml"; + // VAT Number of the entity sending. Rule of thumb: this number matches + // this CVR number present in the certificate. + String virksomhedSENummerIdentifikator = "30808460"; + // Excise number + String afgiftOperatoerPunktAfgiftIdentifikator = "DK82065873300"; + + OIOLedsageDocumentOpretClient oioLedsageDocumentClient = new OIOLedsageDocumentOpretClient(endpointURL); + oioLedsageDocumentClient.invoke(virksomhedSENummerIdentifikator, + afgiftOperatoerPunktAfgiftIdentifikator, ie815); + } + +} \ No newline at end of file