summaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/util/client/ur_V2
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2014-10-16 13:42:04 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2014-10-16 13:42:04 +0200
commite2150f22562b4bc06307f4ac7b842687390e4856 (patch)
tree768250437cca30ab4fda039d924269e37fd99414 /src/main/java/at/gv/util/client/ur_V2
parent2f3b7f180511a5e0af674e3a25ddbaabaa38d36c (diff)
downloadegovutils-e2150f22562b4bc06307f4ac7b842687390e4856.tar.gz
egovutils-e2150f22562b4bc06307f4ac7b842687390e4856.tar.bz2
egovutils-e2150f22562b4bc06307f4ac7b842687390e4856.zip
change webservice implementation to Apache CXF
Diffstat (limited to 'src/main/java/at/gv/util/client/ur_V2')
-rw-r--r--src/main/java/at/gv/util/client/ur_V2/URClient.java37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/main/java/at/gv/util/client/ur_V2/URClient.java b/src/main/java/at/gv/util/client/ur_V2/URClient.java
index edf68c8..134f7f5 100644
--- a/src/main/java/at/gv/util/client/ur_V2/URClient.java
+++ b/src/main/java/at/gv/util/client/ur_V2/URClient.java
@@ -18,9 +18,15 @@ import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.Handler;
import org.apache.commons.lang.RandomStringUtils;
+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;
@@ -52,8 +58,6 @@ import at.gv.util.xsd.ur_V2.search.SucheUnternehmenRequest;
import at.gv.util.xsd.ur_V2.search.SucheUnternehmensdaten;
import at.gv.util.xsd.ur_V2.simpletypes.EvbStatusTyp;
-import com.sun.xml.ws.developer.JAXWSProperties;
-
public class URClient {
@Resource
@@ -335,7 +339,7 @@ public class URClient {
switchTOSecondarySystem(e);
srt = this.urSuche.searchByExample(body);
- } catch (com.sun.xml.ws.client.ClientTransportException e) {
+ } catch (WebServiceException e) {
//request secondary service
switchTOSecondarySystem(e);
srt = this.urSuche.searchByExample(body);
@@ -383,8 +387,15 @@ public class URClient {
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urURL);
//set HTTP Client Timeout (Default Timeout 60sec)
- //requestContext.put(JAXWSProperties.CONNECT_TIMEOUT, this.config.getHTTPRequestTimeout());
- requestContext.put(JAXWSProperties.CONNECT_TIMEOUT, 15000);
+ Client client = ClientProxy.getClient(urSuche);
+ HTTPConduit http = (HTTPConduit) client.getConduit();
+ HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
+
+ //set HTTP Client Timeout (Default Timeout 60sec)
+ httpClientPolicy.setConnectionTimeout(15000);
+ httpClientPolicy.setAllowChunking(false);
+ httpClientPolicy.setReceiveTimeout(32000);
+ http.setClient(httpClientPolicy);
//check for ssl
if (urURL.toLowerCase().startsWith("https")) {
@@ -393,13 +404,15 @@ public class URClient {
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.getURsslConfiguration().useLaxHostNameVerifier()) {
- log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use.");
- requestContext.put(JAXWSProperties.HOSTNAME_VERIFIER, new LaxHostNameVerifier());
- }
+ TLSClientParameters tlsParams = new TLSClientParameters();
+ tlsParams.setSSLSocketFactory(sslContext.getSocketFactory());
+
+ // check for lax hostname
+ if (this.config.getURsslConfiguration().useLaxHostNameVerifier()) {
+ log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use.");
+ tlsParams.setHostnameVerifier(new LaxHostNameVerifier());
+ }
+ http.setTlsClientParameters(tlsParams );
}
}