Skip to content

Instantly share code, notes, and snippets.

@mcihad
Created August 26, 2025 05:29
Show Gist options
  • Save mcihad/78d3479d54bb7b33db907bcdf903e96d to your computer and use it in GitHub Desktop.
Save mcihad/78d3479d54bb7b33db907bcdf903e96d to your computer and use it in GitHub Desktop.
KPS Servislerini java ile sorgulama, Kimlik Doğrulama Servisi için geçerli sadece
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.5'
id 'io.spring.dependency-management' version '1.1.7'
id "com.github.bjornvester.wsdl2java" version "2.0.2"
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.sun.xml.ws:jaxws-rt:4.0.2'
}
wsdl2java {
cxfVersion.set("4.0.2")
useJakarta.set(true)
wsdlDir.set(layout.projectDirectory.dir("src/main/resources/wsdl"))
includes.set(["**/kpspublic.wsdl"])
// Use a generated directory, not src/main/java
generatedSourceDir.set(layout.buildDirectory.dir("generated/sources/wsdl2java"))
packageName.set("tr.bel.sivas.deneme.soap.client.tckimlik")
verbose.set(true)
markGenerated.set(true)
suppressGeneratedDate.set(true)
}
sourceSets {
main {
java {
srcDir("$buildDir/generated/sources/wsdl2java")
}
}
}
//idea üzerinde bu dizini mark directory as ile kaynak dizin olarak ayarlamak gerekiyor.
//Ayrıca spring içerisinde kullanmak için bean tanımlaması yapmak gerek
@Configuration
public class SoapConfig {
@Bean
public KPSPublicSoap kpsPublicSoap() {
try {
return new KPSPublic(new URL("https://tckimlik.nvi.gov.tr/service/kpspublic.asmx?WSDL")).getKPSPublicSoap12();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment