Hi All,
I'm using AXIS 1.3 and WSS4J 1.5 to connect to a webservice the requires
(1) security tokens, (2) digital signatures, and (3) encryption.
Thus,
1. I created the Java Codes by WSDL2Java
2. Created the PWCallback for WSS4J
3. And used the .p12 key given to me.
This is what my client_deploy.wsdd
<deployment xmlns=" http://xml.apache.org/axis/wsdd/ " xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender "/>
<globalConfiguration >
<requestFlow >
<handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
<parameter name="action" value="UsernameToken"/>
<parameter name="user" value="5555454"/>
<parameter name="passwordCallbackClass" value="com.xurpas.mtn.PWCallback "/>
<parameter name="passwordType" value="PasswordDigest"/>
<parameter name="action" value="Signature Encrypt"/>
<parameter name="encryptionKeyIdentifier" value="X509KeyIdentifier" />
<parameter name="signatureKeyIdentifier" value="DirectReference" />
<parameter name="signaturePropFile" value="crypto.properties" />
</handler>
</requestFlow >
</globalConfiguration >
</deployment>
crypto.properties
org.apache.ws.security.crypto.merlin.keystore.type=pkcs12
org.apache.ws.security.crypto.merlin.keystore.password= PasswordMonday
org.apache.ws.security.crypto.merlin.keystore.alias=2 #Since when I keytool -list -v this is the alias I see
org.apache.ws.security.crypto.merlin.file=monday.p12
Keytool -list -v
$ keytool -list -v -keystore monday.p12 -storetype pkcs12 -storePass PasswordMonday
Keystore type: pkcs12
Keystore provider: SunJSSE
Your keystore contains 1 entry
Alias name: 1
Creation date: Jul 12, 2006
Entry type: keyEntry
Certificate chain length: 1
Certificate[1]:
Owner: EMAILADDRESS=[EMAIL PROTECTED] , CN=www.mobile.com, OU=I
nternet Solutions, O=Mobile Technologies (PTY) Ltd., L=hannes, ST
=Gaut, C=MT
Issuer: EMAILADDRESS=[EMAIL PROTECTED] , CN=MTCN CA, OU=Network Group, O=M
TCN Group Ltd, L=RedPort, ST=Gaut, C=MT
Serial number: 38
Valid from: Tue Jun 27 00:22:31 SGT 2006 until: Fri Jun 26 00:22:31 SGT 2009
Certificate fingerprints:
MD5: 31:85:56:8C:46:1E:DE:88:7F:23:48:4B:86:0E:22:46
SHA1: A3:FD:A6:04:8F:3B:EF:21:B4:65:56:59:87:2F:F5:F8:CC:42:6B:BF
*******************************************
*******************************************
The CALLBACK code I used based from example
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof WSPasswordCallback) {
WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
// set the password given a username
if (" 5555454".equals(pc.getIdentifer())) {
pc.setPassword("PasswordMonday ");
}
} else {
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
}
}
}
The code I use to run the application:
String configLocation = "client_deploy.wsdd";
EngineConfiguration config = new FileProvider(configLocation);
ServiceChargingGateway service = new ServiceChargingGatewayLocator(config);
ServiceChargingGatewaySoap message = service.getServiceChargingGatewaySoap();
BillingResponse response = message.eventCharge(msisdn, contentId,
partnerId, ratingId, externalTransactionId, description, contentType);
When I run my application I always get this exception.
WSHandler: Signature: error during message procesingorg.apache.ws.security.WSSecurityException: General security error (Unexpected number of X509Data: for Signature)
org.apache.ws.security.WSSecurityException: WSHandler: Signature: error during message procesing org.apache.ws.security.WSSecuri tyException: General security error (Unexpected number of X509Data: for Signature)
at org.apache.ws.security.action.SignatureAction.execute(SignatureAction.java:57)
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:191)
at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java :170)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain .invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
at org.apache.axis.client.Call.invokeEngine (Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call .invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at zad.com.tpgw.ws.billing .billingrequest.ServiceChargingGatewaySoapStub.eventCharge (ServiceChargingGatewaySoapStub.java:181)
at com.xur.mtc.EventBillingRetryDr iver.sendSms(EventBillingRetryDriver.java:281)
at com.xur.mtc.EventBillingRetryDriver.main(EventBillingRetryDriver.java:416)
Please help, since I have already slipped from the deadline.
Thanks in advance
Ice
- AXIS and WSS4J - org.apache.ws.security.WSSecurityExcep... iceal thaddeus lim
- Re: AXIS and WSS4J - org.apache.ws.security.WSSecu... Ruchith Fernando
