diff options
Diffstat (limited to 'src/main/java/at/gv/util/client/szr/SZRClient.java')
-rw-r--r-- | src/main/java/at/gv/util/client/szr/SZRClient.java | 84 |
1 files changed, 65 insertions, 19 deletions
diff --git a/src/main/java/at/gv/util/client/szr/SZRClient.java b/src/main/java/at/gv/util/client/szr/SZRClient.java index 97e3d12..159f718 100644 --- a/src/main/java/at/gv/util/client/szr/SZRClient.java +++ b/src/main/java/at/gv/util/client/szr/SZRClient.java @@ -13,6 +13,11 @@ import javax.xml.ws.Holder; import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.Handler; +import org.apache.cxf.configuration.jsse.TLSClientParameters; +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.frontend.ClientProxy; +import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,13 +31,19 @@ import at.gv.util.wsdl.szr.SZRException; import at.gv.util.wsdl.szr.SZRService; import at.gv.util.xsd.szr.FremdBPKRequestType; import at.gv.util.xsd.szr.FremdBPKType; +import at.gv.util.xsd.szr.GetBPK; +import at.gv.util.xsd.szr.GetBPKResponse; +import at.gv.util.xsd.szr.GetIdentityLink; +import at.gv.util.xsd.szr.GetIdentityLinkResponse; +import at.gv.util.xsd.szr.GetStammzahl; +import at.gv.util.xsd.szr.GetStammzahlResponse; import at.gv.util.xsd.szr.IdentityLinkType; import at.gv.util.xsd.szr.PersonInfoType; +import at.gv.util.xsd.szr.TransformBPK; +import at.gv.util.xsd.szr.TransformBPKResponse; import at.gv.util.xsd.szr.pvp.PvpTokenType; import at.gv.util.xsd.szr.xmldsig.KeyValueType; -import com.sun.xml.ws.developer.JAXWSProperties; - public class SZRClient { @Resource @@ -52,12 +63,22 @@ public class SZRClient { public IdentityLinkType getIdentityLink(PersonInfoType personInfo, List<KeyValueType> keyValue, Boolean insertERnP) throws SZRException { MiscUtil.assertNotNull(personInfo, "personInfo"); MiscUtil.assertNotNull(keyValue, "keyValue"); - return this.szr.getIdentityLink(personInfo, keyValue, insertERnP); + + GetIdentityLink idlReq = new GetIdentityLink(); + idlReq.setInsertERnP(insertERnP); + idlReq.setPersonInfo(personInfo); + idlReq.getKeyValue().addAll(keyValue); + + GetIdentityLinkResponse idlResp = this.szr.getIdentityLink(idlReq); + return idlResp.getGetIdentityLinkReturn(); } - public String getStammzahl(PersonInfoType personInfo) throws SZRException { - MiscUtil.assertNotNull(personInfo, "personInfo"); - return this.szr.getStammzahl(personInfo); + public String getStammzahl(PersonInfoType personInfo) throws SZRException { + MiscUtil.assertNotNull(personInfo, "personInfo"); + GetStammzahl req = new GetStammzahl(); + req.setPersonInfo(personInfo); + GetStammzahlResponse resp = this.szr.getStammzahl(req ); + return resp.getStammzahl(); } public String getBPK(PersonInfoType personInfo, String target, String vkz) throws SZRException, EgovUtilException { @@ -72,11 +93,15 @@ public class SZRClient { } else { targetString = target; } - Holder<String> returnBPK = new Holder<String>(); - - this.szr.getBPK(personInfo, targetString, vkz, null, false, returnBPK, null, null); - return returnBPK.value; + GetBPK req = new GetBPK(); + req.setPersonInfo(personInfo); + req.setBereichsKennung(targetString); + req.setVKZ(vkz); + req.setListMultiplePersons(false); + GetBPKResponse resp = this.szr.getBPK(req); + return resp.getGetBPKReturn(); + } public String transformBPK(PersonInfoType personInfo, String inputBpk, String inputTarget, String target, String vkz) throws SZRException, EgovUtilException { @@ -97,7 +122,14 @@ public class SZRClient { rt.setVKZ(vkz); List<FremdBPKRequestType> list = new ArrayList<FremdBPKRequestType>(); list.add(rt); - List<FremdBPKType> response = this.szr.transformBPK(personInfo, inputBpk, inputTarget, "kt", list); + + TransformBPK req = new TransformBPK(); + req.setPersonInfo(personInfo); + req.setInputBereichsKennung(targetString); + req.setInputBPK(inputBpk); + req.setBegruendung("kt"); + TransformBPKResponse resp = this.szr.transformBPK(req ); + List<FremdBPKType> response = resp.getTransformBPKReturn(); if (response == null) { return null; } @@ -158,14 +190,28 @@ public class SZRClient { SSLContext sslContext = this.config.getSZRsslConfiguration().getSSLContext(false); if (sslContext == null) { throw new EgovUtilException("SSL context from configuration is empty. Please configure an SSL context in the configuration first."); - } - requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, sslContext.getSocketFactory()); - - // check for lax hostname - if (this.config.getSZRsslConfiguration().useLaxHostNameVerifier()) { - log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use."); - requestContext.put(JAXWSProperties.HOSTNAME_VERIFIER, new LaxHostNameVerifier()); - } + + } + + Client client = ClientProxy.getClient(szr); + HTTPConduit http = (HTTPConduit) client.getConduit(); + HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); + + httpClientPolicy.setConnectionTimeout(36000); + httpClientPolicy.setReceiveTimeout(32000); + + http.setClient(httpClientPolicy); + + TLSClientParameters tlsParams = new TLSClientParameters(); + tlsParams.setSSLSocketFactory(sslContext.getSocketFactory()); + + // check for lax hostname + if (this.config.getSZRsslConfiguration().useLaxHostNameVerifier()) { + log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use."); + tlsParams.setHostnameVerifier(new LaxHostNameVerifier()); + } + + http.setTlsClientParameters(tlsParams ); } } |