diff options
Diffstat (limited to 'src/main/java/at/gv/util/client/moaspss')
-rw-r--r-- | src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java b/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java index 947b558..9430f97 100644 --- a/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java +++ b/src/main/java/at/gv/util/client/moaspss/MOASPSSClient.java @@ -39,6 +39,11 @@ import javax.xml.ws.Service; import javax.xml.ws.handler.Handler; import javax.xml.ws.soap.SOAPBinding; +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.apache.xpath.XPathAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,8 +65,6 @@ import at.gv.util.xsd.moaspss.VerifyCMSSignatureResponseType; import at.gv.util.xsd.moaspss.VerifyXMLSignatureRequestType; import at.gv.util.xsd.moaspss.VerifyXMLSignatureResponseType; -import com.sun.xml.ws.developer.JAXWSProperties; - /** * MOA-SS client. * @@ -146,15 +149,26 @@ public class MOASPSSClient { throw new MOASPSSClientException( "SSL context from configuration is empty. Please configure an SSL context in the configuration first."); } - requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, - sslContext.getSocketFactory()); - + Client client = ClientProxy.getClient(dispatch); + HTTPConduit http = (HTTPConduit) client.getConduit(); + HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); + + httpClientPolicy.setConnectionTimeout(36000); + httpClientPolicy.setAllowChunking(false); + httpClientPolicy.setReceiveTimeout(32000); + + http.setClient(httpClientPolicy); + + TLSClientParameters tlsParams = new TLSClientParameters(); + tlsParams.setSSLSocketFactory(sslContext.getSocketFactory()); + // check for lax hostname if (this.config.getMOASPSSsslConfiguration().useLaxHostNameVerifier()) { log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use."); - requestContext.put(JAXWSProperties.HOSTNAME_VERIFIER, - new LaxHostNameVerifier()); + tlsParams.setHostnameVerifier(new LaxHostNameVerifier()); } + + http.setTlsClientParameters(tlsParams ); } log.trace("Invoking MOA-SS signature creation service."); @@ -279,6 +293,7 @@ public class MOASPSSClient { QName qname = new QName( "http://localhost:8080/moa-spss/services/SignatureVerification", "VerifyXMLSignatureRequest"); + service.addPort(qname, SOAPBinding.SOAP11HTTP_BINDING, serviceURL); ByteArrayOutputStream bos = new ByteArrayOutputStream(); @@ -315,15 +330,26 @@ public class MOASPSSClient { throw new MOASPSSClientException( "SSL context from configuration is empty. Please configure an SSL context in the configuration first."); } - requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, - sslContext.getSocketFactory()); - + Client client = ClientProxy.getClient(dispatch); + HTTPConduit http = (HTTPConduit) client.getConduit(); + HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); + + httpClientPolicy.setConnectionTimeout(36000); + httpClientPolicy.setAllowChunking(false); + httpClientPolicy.setReceiveTimeout(32000); + + http.setClient(httpClientPolicy); + + TLSClientParameters tlsParams = new TLSClientParameters(); + tlsParams.setSSLSocketFactory(sslContext.getSocketFactory()); + // check for lax hostname if (this.config.getMOASPSSsslConfiguration().useLaxHostNameVerifier()) { log.trace("LaxHostnameVerifier enabled. This setting is not recommended to use."); - requestContext.put(JAXWSProperties.HOSTNAME_VERIFIER, - new LaxHostNameVerifier()); + tlsParams.setHostnameVerifier(new LaxHostNameVerifier()); } + + http.setTlsClientParameters(tlsParams ); } log.trace("Invoking MOA-SP signature verification service."); |