http://www.teria.com/~koseki/tools/wssegen/
String user = ‘elegant’;
String password = ‘w790111’;
DateTime createTime = System.now();
String orgNonce = String.valueOf(Crypto.getRandomLong());
String orgCreate = createTime.format(‘yyyy-MM-dd’) + ‘T’ + createTime.format(‘HH:mm:ss’) + ‘Z’;
System.debug(‘orgNonce:’ + orgNonce);
System.debug(‘orgCreate:’ + orgCreate);
String nonce = EncodingUtil.base64Encode(blob.valueOf(orgNonce));
System.debug(‘nonce:’ + nonce);
String encodeStr = nonce + orgCreate + password;
Blob passwordDigest = Crypto.generateDigest(‘SHA1’, Blob.valueOf(encodeStr));
System.debug(” + passwordDigest.toString() );