Skip to content

Commit

Permalink
Merge pull request #74 from SUNET/lundberg_v2_to_v4
Browse files Browse the repository at this point in the history
Navet API v2 to v4
  • Loading branch information
masv3971 authored Sep 4, 2023
2 parents f0c93a6 + 61d65b3 commit 2fc9e29
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
java-version: [8]
java-version: [11]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:8-jre
FROM openjdk:11-jre
# Debian stable no longer has openjdk-8-jre available
# As there is no packages anymore it is probably better
# to use a Docker Hub image to get any security patches
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@

</plugins>

<!-- Build with Java 1.8 -->
<!-- Build with Java 1.11 -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.apache.cxf.transport.http.HTTPConduit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.skatteverket.folkbokforing.na.namnsokningxml.v2.NamnsokningXMLInterface;
import se.skatteverket.folkbokforing.na.namnsokningxml.v2.NamnsokningXMLService;
import se.skatteverket.folkbokforing.na.namnsokningxml.v2.NaWebServiceException;
import se.skatteverket.folkbokforing.na.namnsokningxml.v4.NamnsokningXMLInterface;
import se.skatteverket.folkbokforing.na.namnsokningxml.v4.NamnsokningXMLService;
import se.skatteverket.folkbokforing.na.namnsokningxml.v4.NaWebServiceException;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.*;

import javax.net.ssl.KeyManager;
Expand All @@ -32,7 +32,7 @@ public class NamnsokningService {
private String organisationNumber;
private String orderId;
private String wsBaseEndpoint;
private static String serviceName = "V2/namnsokningXML";
private static String serviceName = "namnsokningXML";

public NamnsokningService(String wsBaseEndpoint, String orgNum, String orderId) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, IOException {
this.wsBaseEndpoint = wsBaseEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.apache.cxf.transport.http.HTTPConduit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.skatteverket.folkbokforing.na.personpostxml.v2.NaWebServiceException;
import se.skatteverket.folkbokforing.na.personpostxml.v2.PersonpostXMLService;
import se.skatteverket.folkbokforing.na.personpostxml.v2.PersonpostXMLInterface;
import se.skatteverket.folkbokforing.na.personpostxml.v4.NaWebServiceException;
import se.skatteverket.folkbokforing.na.personpostxml.v4.PersonpostXMLService;
import se.skatteverket.folkbokforing.na.personpostxml.v4.PersonpostXMLInterface;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.BestallningTYPE;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.PersonpostRequestTYPE;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.ResponseXMLTYPE;
Expand Down Expand Up @@ -35,7 +35,7 @@ public class PersonPostService {
private String organisationNumber;
private String orderId;
private String wsBaseEndpoint;
private static String serviceName = "V2/personpostXML";
private static String serviceName = "personpostXML";

public PersonPostService(String wsBaseEndpoint, String orgNum, String orderId) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, IOException {
this.wsBaseEndpoint = wsBaseEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ private ServletContextHandler getServletContext(String packagesLocation, String
return context;
}

private SslContextFactory getSslContextFactory(String keyStorePath, String keyStorePassword, String keyManagerPassword) {
SslContextFactory sslContextFactory = new SslContextFactory();
private SslContextFactory.Server getSslContextFactory(String keyStorePath, String keyStorePassword, String keyManagerPassword) {
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePassword);
sslContextFactory.setKeyManagerPassword(keyManagerPassword);
return sslContextFactory;
}

private void configureSslServer(String host, Integer port, SslContextFactory sslContextFactory) {
private void configureSslServer(String host, Integer port, SslContextFactory.Server sslContextFactory) {
HttpConfiguration https_config = new HttpConfiguration();
https_config.setSecureScheme("https");
https_config.setSecurePort(port);
Expand Down Expand Up @@ -147,7 +147,7 @@ public void setup(String configFile) throws Exception {
String jettyKeyStorePath = prop.getProperty("jettyKeyStorePath");
String jettyKeyStorePassword = prop.getProperty("jettyKeyStorePassword");
String jettyKeyManagerPassword = prop.getProperty("jettyKeyManagerPassword");
SslContextFactory sslContextFactory = getSslContextFactory(jettyKeyStorePath, jettyKeyStorePassword, jettyKeyManagerPassword);
SslContextFactory.Server sslContextFactory = getSslContextFactory(jettyKeyStorePath, jettyKeyStorePassword, jettyKeyManagerPassword);
configureSslServer(host, port, sslContextFactory);
}
}
Expand Down
23 changes: 15 additions & 8 deletions src/main/resources/META-INF/wsdl/namnsokningXML.wsdl
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:impl="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1" targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v2">
<wsdl:documentation>Version 2.0</wsdl:documentation>
<wsdl:definitions
targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v4"
xmlns:impl="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v4"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1">
<wsdl:documentation>Version 4.0</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v2">
<xsd:import schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
<xsd:schema targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v4" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:import
schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getDataRequest">
Expand All @@ -19,15 +26,15 @@
<wsdl:operation name="getData">
<wsdl:input message="impl:getDataRequest" name="getDataRequest"/>
<wsdl:output message="impl:getDataResponse" name="getDataResponse"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NamnsokningXMLSoapBinding" type="impl:NamnsokningXMLInterface">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getData">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getDataRequest">
<wsdlsoap:body use="literal" parts="parameters"/>
<wsdlsoap:body use="literal" parts="parameters"/>
</wsdl:input>
<wsdl:output name="getDataResponse">
<wsdlsoap:body use="literal" parts="parameters"/>
Expand All @@ -39,7 +46,7 @@
</wsdl:binding>
<wsdl:service name="NamnsokningXMLService">
<wsdl:port binding="impl:NamnsokningXMLSoapBinding" name="namnsokningXML">
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V2/namnsokningXML"/>
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V4/namnsokningXML"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
</wsdl:definitions>
23 changes: 15 additions & 8 deletions src/main/resources/META-INF/wsdl/personpostXML.wsdl
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:impl="http://www.skatteverket.se/folkbokforing/na/personpostXML/v2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1" targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v2">
<wsdl:documentation>Version 2.0</wsdl:documentation>
<wsdl:definitions
targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v4"
xmlns:impl="http://www.skatteverket.se/folkbokforing/na/personpostXML/v4"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1">
<wsdl:documentation>Version 4.0</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v2">
<xsd:import schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
<xsd:schema targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v4" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:import
schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getDataRequest">
Expand All @@ -19,15 +26,15 @@
<wsdl:operation name="getData">
<wsdl:input message="impl:getDataRequest" name="getDataRequest"/>
<wsdl:output message="impl:getDataResponse" name="getDataResponse"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PersonpostXMLSoapBinding" type="impl:PersonpostXMLInterface">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getData">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getDataRequest">
<wsdlsoap:body use="literal" parts="parameters"/>
<wsdlsoap:body use="literal" parts="parameters"/>
</wsdl:input>
<wsdl:output name="getDataResponse">
<wsdlsoap:body use="literal" parts="parameters"/>
Expand All @@ -39,7 +46,7 @@
</wsdl:binding>
<wsdl:service name="PersonpostXMLService">
<wsdl:port binding="impl:PersonpostXMLSoapBinding" name="personpostXML">
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V2/personpostXML"/>
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V4/personpostXML"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
</wsdl:definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

public class SetupCommon {
private static final String KEY_STORE_PATH = "./src/test/resources/kommun-a.p12";
private static final String KEY_STORE_PASSWORD = "5761213661378233";
private static final String KEY_STORE_PASSWORD = "4611510421732432";
private static final String TRUST_KEYSTORE_PATH = "./src/test/resources/truststore.jks";
private static final String TRUST_KEYSTORE_PASSWORD = "abc123";
public static final String WS_BASE_ENDPOINT = "https://www2.test.skatteverket.se/na/na_epersondata";
public static final String WS_BASE_ENDPOINT = "https://www2.test.skatteverket.se/na/na_epersondata/V4";
public static final String TEST_PERSON_NIN = "196608253081";
public static final String TEST_PERSON_REF_NIN = "196709132887";
public static final String TEST_PERSON_GIVEN_NAME = "Teofil";
Expand Down
Binary file modified src/test/resources/kommun-a.p12
Binary file not shown.
4 changes: 2 additions & 2 deletions src/test/resources/navet-service.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jettyKeyStorePassword = secret
jettyKeyManagerPassword = secret

# navetclient services and SSL configuration
wsBaseEndpoint = https://www2.test.skatteverket.se/na/na_epersondata
wsBaseEndpoint = https://www2.test.skatteverket.se/na/na_epersondata/V4
navetKeyStorePath = ./src/test/resources/kommun-a.p12
navetKeyStorePassword = 5761213661378233
navetKeyStorePassword = 4611510421732432
navetTrustStorePath = ./src/test/resources/truststore.jks
navetTrustStorePassword = abc123

Expand Down
Binary file modified src/test/resources/truststore.jks
Binary file not shown.

0 comments on commit 2fc9e29

Please sign in to comment.