You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rainer Montag <mo...@danet.de> on 2008/08/26 15:13:29 UTC

How to use Rampart as Axis2 client from ejb (JBoss) ?

Hello,

I like to implement an Axis2 client that is used from within an EJB 
calling an external web service that requires a UsernameToken.

I have a problem how to setup my Axis2 client code to engage the rampart 
module resulting in a "Unable to engage module: rampart" exception.

My ejb code looks something like this:

          ConfigurationContext ctx = ConfigurationContextFactory
           .createConfigurationContextFromFileSystem(null, null);
           service = new MyServiceStub(ctx, endpoint);

           // engaging rampart and setting authentification information
           Options options = service._getServiceClient().getOptions();
           options.setUserName(authName);
           options.setPassword(authPass);

           service._getServiceClient().engageModule("rampart");

As I'm within my ejb in an EAR, I cannot provide a "file path" to the 
client repository as the first argument of 
createConfigurationContextFromFileSystem(). I've tried to put the 
rampart module in a directory lib/ in my EAR archive and set the 
manifest classpath of my ejb-jar to the lib/ directory, but with no 
success. Anyone got an idea what is wrong ?

I'm using Axis 1.4 and rampart-1.4. The applicationserver to host my EAR 
is JBoss 4.0.5.

Thanks in advance,
   Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How to use Rampart as Axis2 client from ejb (JBoss) ?

Posted by asheikh <as...@gmail.com>.
Andreas,

Thanks a lot,  I have added in the repository/modules/modules.list  with the
following code, and everything is fine, thanks again

My problem was that I have never included modules.list in the repository.

Asad

On Sun, Jun 21, 2009 at 7:42 AM, asheikh <as...@gmail.com> wrote:

>
>
> Andreas,
>
> Thanks for the replay but I have already done that but it didn't work
> either
> URL url = this.getClass().getClassLoader().getResource( "repository");
>
> ConfigurationContext ctxs = ConfigurationContextFactory
>         .createConfigurationContextFromURIs(null, url.getPath())
>
> the above code is working and context is found but the following line still
> complains
>
> _serviceClient.engageModule("rampart");
> > org.apache.axis2.AxisFault: Unable to engage module : rampart
>
> Not sure what you mean " In addition you need to create a
> modules..list file in the modules directory so that Axis2 can load the
> modules."  The code that creates service client is in a jar, but in the war
> I have server axis2 services and I have also added mar in the modules
> directory and listed in the "modules.list"
>
> The problem happens during deployment of ear which has two wars and several
> jars.
>
> thanks
>
>
>
>
>
> On Sat, Jun 20, 2009 at 1:36 PM, Andreas Veithen <
> andreas.veithen@gmail.com> wrote:
>
>> ConfigurationContextFactory has a method to create the
>> ConfigurationContext from a URL. You should use that method and
>> calculate the URL of the repository with the help of
>> Class#getResource. This assumes of course that the content of the
>> repository is in the classpath. In addition you need to create a
>> modules.list file in the modules directory so that Axis2 can load the
>> modules. This is necessary because the concept of "directory listing"
>> is only meaningful for filesystems paths, but not URLs.
>>
>> Andreas
>>
>> On Sat, Jun 20, 2009 at 12:11, asheikh<as...@gmail.com> wrote:
>> > Hi
>> >
>> > The solution of using the following configuration context works(default
>> > context and re-naming mar to jar or copying modules to lib directory) in
>> a
>> > stand alone application, but not in a ear deployment . I have spring
>> > configuration that creates a bean, and in the construction of the bean I
>> > create a stub and configure it with rampart1.3, but my problem is I
>> don't
>> > how to set a relative client repository path, no matter what I do it
>> always
>> > complains about
>> >
>> > org.apache.axis2.AxisFault: Unable to engage module : rampart
>> >
>> > except when I set the full path of the repository
>> >
>> >
>> >
>> > ConfigurationContext myConfigContext =
>> >
>> >
>> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null ,
>> > null)
>> >
>> >   ConfigurationContext ctx = ConfigurationContextFactory
>> >          .createConfigurationContextFromFileSystem(null, null);
>> > service = new MyServiceStub(ctx, endpoint);
>> >  service._getServiceClient().engageModule("rampart");
>> >
>> >
>> > I have spent almost two days,  and I have no solution, other than giving
>> the
>> > full path which I don't like, because I want to minimize the configurion
>> of
>> > the ear during deployment.
>> >
>> > Please help, thanks in advance,
>> >
>> > On Tue, Sep 2, 2008 at 7:28 AM, keith chapman <ke...@gmail.com>
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> You need to have the rampart.mar in the classpath. Perhaps renaming
>> >> rampart.mar to rampart.jar (in the lib directory) will do the trick .
>> >>
>> >> Thanks,
>> >> Keith.
>> >>
>> >> On Tue, Aug 26, 2008 at 6:43 PM, Rainer Montag <mo...@danet.de>
>> wrote:
>> >>>
>> >>> Hello,
>> >>>
>> >>> I like to implement an Axis2 client that is used from within an EJB
>> >>> calling an external web service that requires a UsernameToken.
>> >>>
>> >>> I have a problem how to setup my Axis2 client code to engage the
>> rampart
>> >>> module resulting in a "Unable to engage module: rampart" exception.
>> >>>
>> >>> My ejb code looks something like this:
>> >>>
>> >>>         ConfigurationContext ctx = ConfigurationContextFactory
>> >>>          .createConfigurationContextFromFileSystem(null, null);
>> >>>          service = new MyServiceStub(ctx, endpoint);
>> >>>
>> >>>          // engaging rampart and setting authentification information
>> >>>          Options options = service._getServiceClient().getOptions();
>> >>>          options.setUserName(authName);
>> >>>          options.setPassword(authPass);
>> >>>
>> >>>          service._getServiceClient().engageModule("rampart");
>> >>>
>> >>> As I'm within my ejb in an EAR, I cannot provide a "file path" to the
>> >>> client repository as the first argument of
>> >>> createConfigurationContextFromFileSystem(). I've tried to put the
>> rampart
>> >>> module in a directory lib/ in my EAR archive and set the manifest
>> classpath
>> >>> of my ejb-jar to the lib/ directory, but with no success. Anyone got
>> an idea
>> >>> what is wrong ?
>> >>>
>> >>> I'm using Axis 1.4 and rampart-1.4. The applicationserver to host my
>> EAR
>> >>> is JBoss 4.0.5.
>> >>>
>> >>> Thanks in advance,
>> >>>  Rainer
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Keith Chapman
>> >> Senior Software Engineer
>> >> WSO2 Inc.
>> >> Oxygenating the Web Service Platform.
>> >> http://wso2.org/
>> >>
>> >> blog: http://www.keith-chapman.org
>> >
>> >
>>
>
>

Re: How to use Rampart as Axis2 client from ejb (JBoss) ?

Posted by asheikh <as...@gmail.com>.
Andreas,

Thanks for the replay but I have already done that but it didn't work either

URL url = this.getClass().getClassLoader().getResource( "repository");

ConfigurationContext ctxs = ConfigurationContextFactory
        .createConfigurationContextFromURIs(null, url.getPath())

the above code is working and context is found but the following line still
complains

_serviceClient.engageModule("rampart");
> org.apache.axis2.AxisFault: Unable to engage module : rampart

Not sure what you mean " In addition you need to create a
modules..list file in the modules directory so that Axis2 can load the
modules."  The code that creates service client is in a jar, but in the war
I have server axis2 services and I have also added mar in the modules
directory and listed in the "modules.list"

The problem happens during deployment of ear which has two wars and several
jars.

thanks




On Sat, Jun 20, 2009 at 1:36 PM, Andreas Veithen
<an...@gmail.com>wrote:

> ConfigurationContextFactory has a method to create the
> ConfigurationContext from a URL. You should use that method and
> calculate the URL of the repository with the help of
> Class#getResource. This assumes of course that the content of the
> repository is in the classpath. In addition you need to create a
> modules.list file in the modules directory so that Axis2 can load the
> modules. This is necessary because the concept of "directory listing"
> is only meaningful for filesystems paths, but not URLs.
>
> Andreas
>
> On Sat, Jun 20, 2009 at 12:11, asheikh<as...@gmail.com> wrote:
> > Hi
> >
> > The solution of using the following configuration context works(default
> > context and re-naming mar to jar or copying modules to lib directory) in
> a
> > stand alone application, but not in a ear deployment . I have spring
> > configuration that creates a bean, and in the construction of the bean I
> > create a stub and configure it with rampart1.3, but my problem is I don't
> > how to set a relative client repository path, no matter what I do it
> always
> > complains about
> >
> > org.apache.axis2.AxisFault: Unable to engage module : rampart
> >
> > except when I set the full path of the repository
> >
> >
> >
> > ConfigurationContext myConfigContext =
> >
> > ConfigurationContextFactory.createConfigurationContextFromFileSystem(null
> ,
> > null)
> >
> >   ConfigurationContext ctx = ConfigurationContextFactory
> >          .createConfigurationContextFromFileSystem(null, null);
> > service = new MyServiceStub(ctx, endpoint);
> >  service._getServiceClient().engageModule("rampart");
> >
> >
> > I have spent almost two days,  and I have no solution, other than giving
> the
> > full path which I don't like, because I want to minimize the configurion
> of
> > the ear during deployment.
> >
> > Please help, thanks in advance,
> >
> > On Tue, Sep 2, 2008 at 7:28 AM, keith chapman <ke...@gmail.com>
> > wrote:
> >>
> >> Hi,
> >>
> >> You need to have the rampart.mar in the classpath. Perhaps renaming
> >> rampart.mar to rampart.jar (in the lib directory) will do the trick .
> >>
> >> Thanks,
> >> Keith.
> >>
> >> On Tue, Aug 26, 2008 at 6:43 PM, Rainer Montag <mo...@danet.de> wrote:
> >>>
> >>> Hello,
> >>>
> >>> I like to implement an Axis2 client that is used from within an EJB
> >>> calling an external web service that requires a UsernameToken.
> >>>
> >>> I have a problem how to setup my Axis2 client code to engage the
> rampart
> >>> module resulting in a "Unable to engage module: rampart" exception.
> >>>
> >>> My ejb code looks something like this:
> >>>
> >>>         ConfigurationContext ctx = ConfigurationContextFactory
> >>>          .createConfigurationContextFromFileSystem(null, null);
> >>>          service = new MyServiceStub(ctx, endpoint);
> >>>
> >>>          // engaging rampart and setting authentification information
> >>>          Options options = service._getServiceClient().getOptions();
> >>>          options.setUserName(authName);
> >>>          options.setPassword(authPass);
> >>>
> >>>          service._getServiceClient().engageModule("rampart");
> >>>
> >>> As I'm within my ejb in an EAR, I cannot provide a "file path" to the
> >>> client repository as the first argument of
> >>> createConfigurationContextFromFileSystem(). I've tried to put the
> rampart
> >>> module in a directory lib/ in my EAR archive and set the manifest
> classpath
> >>> of my ejb-jar to the lib/ directory, but with no success. Anyone got an
> idea
> >>> what is wrong ?
> >>>
> >>> I'm using Axis 1.4 and rampart-1.4. The applicationserver to host my
> EAR
> >>> is JBoss 4.0.5.
> >>>
> >>> Thanks in advance,
> >>>  Rainer
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >>> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>>
> >>
> >>
> >>
> >> --
> >> Keith Chapman
> >> Senior Software Engineer
> >> WSO2 Inc.
> >> Oxygenating the Web Service Platform.
> >> http://wso2.org/
> >>
> >> blog: http://www.keith-chapman.org
> >
> >
>

Re: How to use Rampart as Axis2 client from ejb (JBoss) ?

Posted by Andreas Veithen <an...@gmail.com>.
ConfigurationContextFactory has a method to create the
ConfigurationContext from a URL. You should use that method and
calculate the URL of the repository with the help of
Class#getResource. This assumes of course that the content of the
repository is in the classpath. In addition you need to create a
modules.list file in the modules directory so that Axis2 can load the
modules. This is necessary because the concept of "directory listing"
is only meaningful for filesystems paths, but not URLs.

Andreas

On Sat, Jun 20, 2009 at 12:11, asheikh<as...@gmail.com> wrote:
> Hi
>
> The solution of using the following configuration context works(default
> context and re-naming mar to jar or copying modules to lib directory) in a
> stand alone application, but not in a ear deployment . I have spring
> configuration that creates a bean, and in the construction of the bean I
> create a stub and configure it with rampart1.3, but my problem is I don't
> how to set a relative client repository path, no matter what I do it always
> complains about
>
> org.apache.axis2.AxisFault: Unable to engage module : rampart
>
> except when I set the full path of the repository
>
>
>
> ConfigurationContext myConfigContext =
>
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null ,
> null)
>
>   ConfigurationContext ctx = ConfigurationContextFactory
>          .createConfigurationContextFromFileSystem(null, null);
> service = new MyServiceStub(ctx, endpoint);
>  service._getServiceClient().engageModule("rampart");
>
>
> I have spent almost two days,  and I have no solution, other than giving the
> full path which I don't like, because I want to minimize the configurion of
> the ear during deployment.
>
> Please help, thanks in advance,
>
> On Tue, Sep 2, 2008 at 7:28 AM, keith chapman <ke...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> You need to have the rampart.mar in the classpath. Perhaps renaming
>> rampart.mar to rampart.jar (in the lib directory) will do the trick .
>>
>> Thanks,
>> Keith.
>>
>> On Tue, Aug 26, 2008 at 6:43 PM, Rainer Montag <mo...@danet.de> wrote:
>>>
>>> Hello,
>>>
>>> I like to implement an Axis2 client that is used from within an EJB
>>> calling an external web service that requires a UsernameToken.
>>>
>>> I have a problem how to setup my Axis2 client code to engage the rampart
>>> module resulting in a "Unable to engage module: rampart" exception.
>>>
>>> My ejb code looks something like this:
>>>
>>>         ConfigurationContext ctx = ConfigurationContextFactory
>>>          .createConfigurationContextFromFileSystem(null, null);
>>>          service = new MyServiceStub(ctx, endpoint);
>>>
>>>          // engaging rampart and setting authentification information
>>>          Options options = service._getServiceClient().getOptions();
>>>          options.setUserName(authName);
>>>          options.setPassword(authPass);
>>>
>>>          service._getServiceClient().engageModule("rampart");
>>>
>>> As I'm within my ejb in an EAR, I cannot provide a "file path" to the
>>> client repository as the first argument of
>>> createConfigurationContextFromFileSystem(). I've tried to put the rampart
>>> module in a directory lib/ in my EAR archive and set the manifest classpath
>>> of my ejb-jar to the lib/ directory, but with no success. Anyone got an idea
>>> what is wrong ?
>>>
>>> I'm using Axis 1.4 and rampart-1.4. The applicationserver to host my EAR
>>> is JBoss 4.0.5.
>>>
>>> Thanks in advance,
>>>  Rainer
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>
>>
>>
>> --
>> Keith Chapman
>> Senior Software Engineer
>> WSO2 Inc.
>> Oxygenating the Web Service Platform.
>> http://wso2.org/
>>
>> blog: http://www.keith-chapman.org
>
>

Re: How to use Rampart as Axis2 client from ejb (JBoss) ?

Posted by asheikh <as...@gmail.com>.
Hi

The solution of using the following configuration context works(default
context and re-naming mar to jar or copying modules to lib directory) in a
stand alone application, but not in a ear deployment . I have spring
configuration that creates a bean, and in the construction of the bean I
create a stub and configure it with rampart1.3, but my problem is I don't
how to set a relative client repository path, no matter what I do it always
complains about
*
org.apache.axis2.AxisFault: Unable to engage module : rampart*

except when I set the full path of the repository



ConfigurationContext myConfigContext =
         ConfigurationContextFactory.createConfigurationContextFromFileSystem(null
, null)

  ConfigurationContext ctx = ConfigurationContextFactory
         .createConfigurationContextFromFileSystem(null, null);
service = new MyServiceStub(ctx, endpoint);
 service._getServiceClient().engageModule("rampart");


I have spent almost two days,  and I have no solution, other than giving the
full path which I don't like, because I want to minimize the configurion of
the ear during deployment.

Please help, thanks in advance,

On Tue, Sep 2, 2008 at 7:28 AM, keith chapman <ke...@gmail.com>wrote:

> Hi,
>
> You need to have the rampart.mar in the classpath. Perhaps renaming
> rampart.mar to rampart.jar (in the lib directory) will do the trick .
>
> Thanks,
> Keith.
>
>
> On Tue, Aug 26, 2008 at 6:43 PM, Rainer Montag <mo...@danet.de> wrote:
>
>> Hello,
>>
>> I like to implement an Axis2 client that is used from within an EJB
>> calling an external web service that requires a UsernameToken.
>>
>> I have a problem how to setup my Axis2 client code to engage the rampart
>> module resulting in a "Unable to engage module: rampart" exception.
>>
>> My ejb code looks something like this:
>>
>>         ConfigurationContext ctx = ConfigurationContextFactory
>>          .createConfigurationContextFromFileSystem(null, null);
>>          service = new MyServiceStub(ctx, endpoint);
>>
>>          // engaging rampart and setting authentification information
>>          Options options = service._getServiceClient().getOptions();
>>          options.setUserName(authName);
>>          options.setPassword(authPass);
>>
>>          service._getServiceClient().engageModule("rampart");
>>
>> As I'm within my ejb in an EAR, I cannot provide a "file path" to the
>> client repository as the first argument of
>> createConfigurationContextFromFileSystem(). I've tried to put the rampart
>> module in a directory lib/ in my EAR archive and set the manifest classpath
>> of my ejb-jar to the lib/ directory, but with no success. Anyone got an idea
>> what is wrong ?
>>
>> I'm using Axis 1.4 and rampart-1.4. The applicationserver to host my EAR
>> is JBoss 4.0.5.
>>
>> Thanks in advance,
>>  Rainer
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
>
> --
> Keith Chapman
> Senior Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://www.keith-chapman.org
>

Re: How to use Rampart as Axis2 client from ejb (JBoss) ?

Posted by keith chapman <ke...@gmail.com>.
Hi,

You need to have the rampart.mar in the classpath. Perhaps renaming
rampart.mar to rampart.jar (in the lib directory) will do the trick .

Thanks,
Keith.

On Tue, Aug 26, 2008 at 6:43 PM, Rainer Montag <mo...@danet.de> wrote:

> Hello,
>
> I like to implement an Axis2 client that is used from within an EJB calling
> an external web service that requires a UsernameToken.
>
> I have a problem how to setup my Axis2 client code to engage the rampart
> module resulting in a "Unable to engage module: rampart" exception.
>
> My ejb code looks something like this:
>
>         ConfigurationContext ctx = ConfigurationContextFactory
>          .createConfigurationContextFromFileSystem(null, null);
>          service = new MyServiceStub(ctx, endpoint);
>
>          // engaging rampart and setting authentification information
>          Options options = service._getServiceClient().getOptions();
>          options.setUserName(authName);
>          options.setPassword(authPass);
>
>          service._getServiceClient().engageModule("rampart");
>
> As I'm within my ejb in an EAR, I cannot provide a "file path" to the
> client repository as the first argument of
> createConfigurationContextFromFileSystem(). I've tried to put the rampart
> module in a directory lib/ in my EAR archive and set the manifest classpath
> of my ejb-jar to the lib/ directory, but with no success. Anyone got an idea
> what is wrong ?
>
> I'm using Axis 1.4 and rampart-1.4. The applicationserver to host my EAR is
> JBoss 4.0.5.
>
> Thanks in advance,
>  Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org