I would use Fernando's Test Code for WSS4J
contents of wss40.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=security
org.apache.ws.security.crypto.merlin.keystore.alias=wss40
org.apache.ws.security.crypto.merlin.keystore.file=keys/wss40.jks
package org.apache.ws.security.message;
public class SecurityContextTokenTest {
public org.apache.ws.security.components.crypto.Crypto crypto =
org.apache.ws.security.components.crypto.CryptoFactory.getInstance("wss40.properties");
try {
org.w3c.dom.Document doc =
org.apache.ws.security.common.SOAPUtil.toSOAPPart(org.apache.ws.security.common.SOAPUtil.SAMPLE_SOAP_MSG);
org.apache.ws.security.message.WSSecHeader secHeader = new
org.apache.ws.security.message.WSSecHeader();
secHeader.insertSecurityHeader(doc);
org.apache.ws.security.message.WSSecSecurityContextToken sctBuilder
= new org.apache.ws.security.message.WSSecSecurityContextToken();
sctBuilder.prepare(doc, crypto);
sctBuilder.prependSCTElementToHeader(doc, secHeader);
String out =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
if (LOG.isDebugEnabled())
{
LOG.debug(out);
}
assertTrue(
"SecurityContextToken missing",
out.indexOf(org.apache.ws.security.conversation.ConversationConstants.SECURITY_CONTEXT_TOKEN_LN)
> 0
);
assertTrue(
"wsc:Identifier missing",
out.indexOf(org.apache.ws.security.conversation.ConversationConstants.IDENTIFIER_LN)
> 0
);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
I would locate the code in the WAR and NOT in the ejb code but if you want to
finesse the CL order goto
http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Fcrun_classload.html
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfal
tet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit
von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
From: [email protected]
To: [email protected]
Date: Thu, 16 Aug 2012 12:19:14 -0400
Subject: Need advice how to run Axis2/Rampart client from Webshere
Hello, I need to be able to make web service calls using WS-Security from the
application that runs on Websphere. Are there any instructions how to do
that?My prototype standalone client sets up the ConfigurationContext as follows
ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem("c:/stage/axis2-1.6.2/repository",
null); How can it be done in the web application environment where the
application is packaged in .ear file? TIA, -a