首先,请原谅我英语不好。 所以我需要帮助。一周多来,我遇到了问题,无法找到解决方案。
<wsdl:definitions name="EDeliveryIntegrationService" targetNamespace="http://tempuri.org/">
<wsp:Policy wsu:Id="BasicHttpBinding_IEDeliveryIntegrationService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsoma:OptimizedMimeSerialization/>
<sp:TransportBinding>
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy></wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:EndorsingSupportingTokens>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:EndorsingSupportingTokens>
<sp:Wss10>
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
........
.......
</wsdl:definitions>
我正在使用不带弹簧的apache CXF ,并且找不到添加用于身份验证的客户端证书的方法。
有帮助吗?
编辑
嗯。我没有HTTPS问题。在我的资料中,我有这样的东西:
SSLContext sslCtx = null;
sslCtx = SSLContext.getInstance("TLSv1.2");
/************** TRUST STORE *****************/
KeyStore trustStore = KeyStore.getInstance("jks");
trustStore.load(new FileInputStream(pathToStore), passForStore.toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
// ***************** KEY STORE *********************/
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
.getDefaultAlgorithm());
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream keyStoreIn = new FileInputStream(pathToCert);
keyStore.load(keyStoreIn, passForCert.toCharArray()); // This is jks key
kmf.init(keyStore, passForCert.toCharArray()); // this is pk key
sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
ctxt.put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",
sslCtx.getSocketFactory());
ctxt.put("com.sun.xml.ws.transport.https.client.SSLSocketFactory",
sslCtx.getSocketFactory());
该地址是公开地址(https://edelivery.egov.bg/Services/EDeliveryIntegrationService.svc?wsdl) 当您尝试使用某些终结点时会发生问题。然后,您需要使用证书。 这是一种类似用户名/密码的身份验证,但是如何设置证书?