सबसे पहले, मैं सारांश के साथ शुरू करूंगा। मैं अपाचे सीएक्सएफ क्लाइंट का उपयोग एक अपाचे सीएक्सएफ सेवा प्रदाता के साथ एसएसएल पर संवाद करने के लिए कर रहा हूं जो एक स्व-हस्ताक्षरित प्रमाणपत्र का उपयोग कर रहा है। मैंने क्लाइंट सर्वर पर वेबस्पेयर ट्रस्टस्टोर में प्रमाण पत्र आयात किया, लेकिन मुझे अभी भी एक "javax.net.ssl.SSLHandshakeException प्राप्त होता है: SSLHandshakeException https://somesvcprovider.com/appname/svc/myservice का आविष्कार: com.ibm.jsse2.util.h: कोई विश्वसनीय प्रमाणपत्र नहीं मिला" अपवाद।वेबशेयर ट्रस्टस्टोर का उपयोग करने के लिए अपाचे सीएक्सएफ क्लाइंट को कैसे सेट अप करें? ("कोई भरोसेमंद प्रमाणपत्र नहीं मिला" अपवाद प्राप्त करना।)
अब, यहाँ विवरण है:
मैं एक अपाचे CXF वेब सेवा ग्राहक है कि मैं वसंत का उपयोग कर रहा हूँ को विन्यस्त है, और ग्राहक एक WebSphere 6.1 आवेदन सर्वर के लिए तैनात किया गया है। सीएक्सएफ क्लाइंट एक अलग वेबस्फेयर सर्वर पर अपाचे सीएक्सएफ सेवा प्रदाता के साथ संचार करता है। संचार एसएसएल का उपयोग करता है।
सेवा प्रदाता एक स्व-हस्ताक्षरित प्रमाणपत्र का उपयोग कर रहा है। मैंने प्रदाता प्रमाणपत्र को क्लाइंट सर्वर पर व्यवस्थापकीय कंसोल के माध्यम से वेबस्पेयर ट्रस्टस्टोर में आयात किया है। मैंने SSL प्रमाणपत्र और कुंजी प्रबंधन> SSL कॉन्फ़िगरेशन> NodeDefaultSSLSettings> कुंजी स्टोर और प्रमाणपत्र> NodeDefaultTrustStore> हस्ताक्षर प्रमाणपत्र पर जाकर इसे पूरा किया; तो मैंने प्रमाण पत्र आयात करने के लिए "बंदरगाह से पुनर्प्राप्त" टूल का उपयोग किया। "Javax.net.ssl.SSLHandshakeException: SSLHandshakeException लागू https://somesvcprovider.com/appname/svc/myservice: com.ibm.jsse2.util.h: नहीं विश्वसनीय प्रमाणपत्र मिला"
हालांकि, मैं अब भी इस त्रुटि जब सेवा प्रदाता से संपर्क करने का प्रयास कर प्राप्त करते हैं।
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<http:conduit name="*.http-conduit">
<!-- deactivate HTTPS url hostname verification (localhost, etc) -->
<!-- WARNING ! disableCNcheck=true should not used in production. -->
<http:tlsClientParameters disableCNCheck="true" />
</http:conduit>
<!-- Read properties from property file(s). -->
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!-- The *.spring.properties files are prefixed with a system property
that is set on the WebSphere server. -->
<value>classpath:spring.${my.env}.properties</value>
</list>
</property>
</bean>
<jaxws:client id="myServiceClient"
serviceClass="com.client.stub.cxf.IMyService"
address="${my.svc.url}" />
<bean id="myReport" class="com.client.MyReportRequestor">
<property name="client" ref="myServiceClient"/>
</bean>
</beans>
जैसा कि ऊपर दिखाया गया है, CXF ग्राहक स्प्रिंग द्वारा एक सेटर के माध्यम से इंजेक्ट किया जाता है:
स्प्रिंग विन्यास फाइल इस प्रकार है। सेवा से संपर्क करने के लिए कोड के नीचे है:
List<String> formNames = client.retrieveNames(formIdsList);
इसके अलावा, मैं अगर यह संबंधित है पता नहीं है, लेकिन कोई भरोसा प्रबंधकों लौटा दिए जाते हैं जब मैं निरीक्षण TLSClientParameters रनटाइम पर CXF ग्राहक पर आपत्ति है। निरीक्षण करने के लिए कोड के नीचे है:
// Get the trust managers for this client.
Client proxy = ClientProxy.getClient(client);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
TLSClientParameters tls = conduit.getTlsClientParameters();
TrustManager[] trustManagers = tls.getTrustManagers(); // trustManagers is null
ऐसा कुछ हो जिसमें मैं स्व-हस्ताक्षरित प्रमाणपत्र पर भरोसा करने अपाचे CXF ग्राहक पाने के लिए क्या करने की जरूरत है?
मैं कॉन्फ़िगरेशन फ़ाइल में पासवर्ड के साथ ट्रस्टस्टोर के पथ को निर्दिष्ट करने की आवश्यकता नहीं है।
धन्यवाद!
मुझे डब्ल्यूएएस ट्रस्टस्टोर का उपयोग करने का कोई तरीका नहीं मिल रहा है, इसलिए मुझे लगता है कि आपको कॉन्फ़िगरेशन फ़ाइल में ट्रस्टस्टोर निर्दिष्ट करना होगा जैसा आपने बताया था। –
मुझे @kjetil समाधान अधिक व्यवहार्य लगता है, क्योंकि इसे कस्टम विकास –