Solved:
1. I have set two system properties from my startup servlet.
System.setProperty(org.apache.axis2.Constants.AXIS2_CONF,
config.getServletContext().getRealPath("/WEB-INF/conf/axis2.xml"));
System.setProperty(org.apache.axis2.Constants.AXIS2_REPO,
config.getServletContext().getRealPath("/WEB-INF"));
2. added <module ref="rampart"/> to axis2.xml and added the rampart
modules to the WEB-INF/modues dir of Tomcat.
3. I have created the configuration context only ones and have reused
it when creating a new client
MyStub stub = new MyStub(MyConfigFactory.getConfigCtx());
Is that sounds like the right way of doing it?
On Fri, May 18, 2012 at 1:53 PM, Kishanthan Thangarajah
<[email protected]> wrote:
>
>
> On Thu, May 10, 2012 at 10:04 PM, Asen <[email protected]> wrote:
>>
>> Hi there,
>>
>> I am trying to use wsdl2ejava Axis-1.6.2 generated stubs and including
>> Rampart-1.6.2 for the WS-Sec.
>> I have copied in to my application all the required Axis/Rampart jars,
>> modules and created the required directory structure when building it.
>> All my web services and generated code clients are deployed, visible
>> and ready to go.
>>
>> But here is what I am experiencing when I try to invoke a client stub
>> and make him engage 'rampart' module to pass the WCF exposed service
>> with UsernameToken security.
>> "Unable to engage module : rampart"
>>
>> Hmm, looked at the code and this seems to make sense even though all
>> axis2 and rampart modules are deployed during startup form the
>> WarBasedAxisConfigurator.
>> When the stub's service client is configured a null
>> ConfigurationContext is used as in previous versions but here the
>> check for if (MessageContext.getCurrentMessageContext() == null)
>> always
>> is true and new ConfigurationContext is created from file system which
>> uses the default axis2.xml and since a repository location is not
>> specified it seems that fails to find the deployed modules in
>> WEB-INF/modules
>> In other words I am receiving a AxisConfiguration without any modules.
>>
>> What I am doing wrong here?
>
>
> Can you give us some more info on how you configured rampart on client
> side?. Some code section from your client would be better. Just to be
> sure, check whether rampart and other third party libraries are in the
> client class path. Also when creating the ConfigurationContext from file
> system using a repository, please make sure that you have given the correct
> location and also the rampart module (rampart.mar) is placed under modules
> directory.
>
> Thanks,
> Kishanthan.
>>
>> I had not have the issue with Axis-1.5 since there it was using a
>> Listener instead of MessageContext.getCurrentMessageContext()
>>
>> My axis2.xml is the same as it comes from the distribution, but with
>> added two more globally engaged modules.
>>
>> <module ref="addressing"/>
>> <module ref="soapmonitor" />
>> <module ref="rampart"/>
>>
>> private void configureServiceClient(ConfigurationContext
>> configContext, AxisService axisService)
>> throws AxisFault {
>> if (configContext == null) {
>> if (MessageContext.getCurrentMessageContext() == null) {
>> configContext = ConfigurationContextFactory.
>> createConfigurationContextFromFileSystem(null,
>> null);
>> createConfigCtx = true;
>> } else {
>> configContext =
>> MessageContext.getCurrentMessageContext().getConfigurationContext();
>> }
>> }
>> this.configContext = configContext;
>> hashCode = (int)anonServiceCounter.incrementAndGet();
>>
>> // Initialize transports
>> ListenerManager transportManager =
>> configContext.getListenerManager();
>> if (transportManager == null) {
>> transportManager = new ListenerManager();
>> transportManager.init(this.configContext);
>> }
>>
>> // save the axisConfig and service
>> axisConfig = configContext.getAxisConfiguration();
>>
>> if (axisService == null) {
>> axisService = createAnonymousService();
>> }
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]