我必須使用WS-Security的WebService客戶端有問題。 我的客戶是用axis2
寫的。當我不啓用 加密(當然與我的服務器模擬器)。我啓用了加密 通過向axis.xml
:Axis2 /採用signaturePropFile的壘門密碼問題
<!--Signature and Encryption : Using the request's certificate-->
<module ref="rampart" />
<parameter name="OutflowSecurity">
<action>
<items>Signature</items>
<user>mn</user>
<passwordCallbackClass>PWCallback</passwordCallbackClass>
<signaturePropFile>client.properties</signaturePropFile>
<signatureKeyIdentifier>SKIKeyIdentifier</signatureKeyIdentifier>
<signatureParts>{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body</signatureParts>
</action>
</parameter>
現在,當我調用客戶端從Eclipse中使用參數:
-Daxis2.xml=axis-repo/conf/axis2.xml -Daxis2.repo=axis-repo
我:
org.apache.axis2.AxisFault: CryptoFactory: Cannot load properties: client.properties
at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:67)
at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72)
at org.apache.axis2.engine.Phase.invoke(Phase.java:318)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
...
Caused by: java.lang.RuntimeException: CryptoFactory: Cannot load properties: client.properties
at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(CryptoFactory.java:258)
at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(CryptoFactory.java:171)
at org.apache.ws.security.handler.WSHandler.loadSignatureCrypto(WSHandler.java:431)
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:137)
at org.apache.rampart.handler.WSDoAllSender.processBasic(WSDoAllSender.java:201)
at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:64)
... 9 more
Caused by: java.lang.NullPointerException
at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(CryptoFactory.java:253)
... 14 more
我能打開client.properties
as File
object。我試圖把這個 文件放在不同的目錄中,或者改變它的名字來使用完整路徑(當我在Windows上工作時,都使用斜槓, 和反斜槓),但沒有任何幫助。
我client.properties文件看起來像:
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=mn
org.apache.ws.security.crypto.merlin.file=mn_keystore.ks
任何想法,爲什麼我得到這個錯誤?