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 Paul French <pa...@kirona.com> on 2008/12/28 18:35:16 UTC

Modules and Handlers

I have written a simple Module that logs all SOAP messages into a database.
 
My handlers needs access to resources setup in the Module init method e.g a
DataSource
 
I cannot see how a handler can get access to resources setup in the module?
Can someone give me a clue?
 
Thanks
Paul
 
 

Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
I see.

Thanks a lot
Guo
  ----- Original Message ----- 
  From: Amila Suriarachchi
  To: axis-user@ws.apache.org
  Sent: Tuesday, December 30, 2008 11:04 PM
  Subject: Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01





  On Tue, Dec 30, 2008 at 12:20 PM, Guo Tianchong <gu...@nec-as.nec.com.cn> wrote:

    My service is working well via Axis2 client.

    It seems that the MS Web Services Toolkit 2.01 do not support complex type XML input.

    The real world is:

    My service operation's parameter is a AXIOM OMElement.

    I called this service operation in VBA, and passed a XML String to it.
    At the service operation side, I sysout the operation's parameter value.
    It's supprised that the input paramerter is encapsulated by
    <param0...> ... </param0> and the XML '<' character is also changed to '&lt;'
  this means it try to send your xml as a string. i.e. your xml string as the value of the param0

  thanks,
  Amila.



    Do you know how to deal this problem?
    Anybody else?

    Thanks!
    Guo
      ----- Original Message ----- 
      From: Amila Suriarachchi
      To: axis-user@ws.apache.org
      Sent: Tuesday, December 30, 2008 10:44 AM
      Subject: Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01


      First try to access the service with a Axis2 client. Anyway sending the full stack trace(see the server console) may be 
useful.


      thanks,
      Amila.


      On Mon, Dec 29, 2008 at 1:59 PM, Guo Tianchong <gu...@nec-as.nec.com.cn> wrote:

        Hi all,

        I create a very simple Web Service in AXIOM for my project.
        Now, I need to test it using Microsoft Office 2003 Web Services Toolkit 2.01.

        But when I call the proxy of my Service in EXCEL, it always alert

        run time error 2147221504(80040000)
        java.lang.NullPointerException

        Does anyone know how to resolve this problem?

        Thanks!

        Guo






      -- 
      Amila Suriarachchi
      WSO2 Inc.
      blog: http://amilachinthaka.blogspot.com/




  -- 
  Amila Suriarachchi
  WSO2 Inc.
  blog: http://amilachinthaka.blogspot.com/

Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Dec 30, 2008 at 12:20 PM, Guo Tianchong <gu...@nec-as.nec.com.cn>wrote:

>  My service is working well via Axis2 client.
>
> It seems that the MS Web Services Toolkit 2.01 do not support complex
> type XML input.
>
> The real world is:
>
> My service operation's parameter is a AXIOM OMElement.
>
> I called this service operation in VBA, and passed a XML String to it.
> At the service operation side, I sysout the operation's parameter value.
> It's supprised that the input paramerter is encapsulated by
> <param0...> ... </param0> and the XML '<' character is also changed to
> '&lt;'
>
this means it try to send your xml as a string. i.e. your xml string as the
value of the param0

thanks,
Amila.

>
>
> Do you know how to deal this problem?
> Anybody else?
>
> Thanks!
> Guo
>
> ----- Original Message -----
> *From:* Amila Suriarachchi <am...@gmail.com>
> *To:* axis-user@ws.apache.org
> *Sent:* Tuesday, December 30, 2008 10:44 AM
> *Subject:* Re: Call AXIOM Web Service Using Microsoft Office 2003 Web
> Services Toolkit 2.01
>
> First try to access the service with a Axis2 client. Anyway sending the
> full stack trace(see the server console) may be useful.
>
>
> thanks,
> Amila.
>
> On Mon, Dec 29, 2008 at 1:59 PM, Guo Tianchong <gu...@nec-as.nec.com.cn>wrote:
>
>> Hi all,
>>
>> I create a very simple Web Service in AXIOM for my project.
>> Now, I need to test it using Microsoft Office 2003 Web Services Toolkit
>> 2.01.
>>
>> But when I call the proxy of my Service in EXCEL, it always alert
>>
>> run time error 2147221504(80040000)
>> java.lang.NullPointerException
>>
>> Does anyone know how to resolve this problem?
>>
>> Thanks!
>>
>> Guo
>>
>>
>>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
My service is working well via Axis2 client.

It seems that the MS Web Services Toolkit 2.01 do not support complex type XML input.

The real world is:

My service operation's parameter is a AXIOM OMElement.

I called this service operation in VBA, and passed a XML String to it.
At the service operation side, I sysout the operation's parameter value.
It's supprised that the input paramerter is encapsulated by 
<param0...> ... </param0> and the XML '<' character is also changed to '&lt;'

Do you know how to deal this problem?
Anybody else?

Thanks!
Guo
  ----- Original Message ----- 
  From: Amila Suriarachchi 
  To: axis-user@ws.apache.org 
  Sent: Tuesday, December 30, 2008 10:44 AM
  Subject: Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01


  First try to access the service with a Axis2 client. Anyway sending the full stack trace(see the server console) may be useful.


  thanks,
  Amila.


  On Mon, Dec 29, 2008 at 1:59 PM, Guo Tianchong <gu...@nec-as.nec.com.cn> wrote:

    Hi all,

    I create a very simple Web Service in AXIOM for my project.
    Now, I need to test it using Microsoft Office 2003 Web Services Toolkit 2.01.

    But when I call the proxy of my Service in EXCEL, it always alert

    run time error 2147221504(80040000)
    java.lang.NullPointerException

    Does anyone know how to resolve this problem?

    Thanks!

    Guo






  -- 
  Amila Suriarachchi
  WSO2 Inc.
  blog: http://amilachinthaka.blogspot.com/

Re: Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01

Posted by Amila Suriarachchi <am...@gmail.com>.
First try to access the service with a Axis2 client. Anyway sending the full
stack trace(see the server console) may be useful.


thanks,
Amila.

On Mon, Dec 29, 2008 at 1:59 PM, Guo Tianchong <gu...@nec-as.nec.com.cn>wrote:

> Hi all,
>
> I create a very simple Web Service in AXIOM for my project.
> Now, I need to test it using Microsoft Office 2003 Web Services Toolkit
> 2.01.
>
> But when I call the proxy of my Service in EXCEL, it always alert
>
> run time error 2147221504(80040000)
> java.lang.NullPointerException
>
> Does anyone know how to resolve this problem?
>
> Thanks!
>
> Guo
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Call AXIOM Web Service Using Microsoft Office 2003 Web Services Toolkit 2.01

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
Hi all, 

I create a very simple Web Service in AXIOM for my project.
Now, I need to test it using Microsoft Office 2003 Web Services Toolkit 2.01.

But when I call the proxy of my Service in EXCEL, it always alert

run time error 2147221504(80040000)
java.lang.NullPointerException

Does anyone know how to resolve this problem?

Thanks!

Guo



RE: Modules and Handlers

Posted by Paul French <pa...@kirona.com>.
Hello Amila,
 
thanks for your input. As far as I can tell Axis2 provides Spring
integration for services but not modules hence the link you provided below
does not help me.
 
Having to obtain the required resources from the configuration context on
every invoke method of the handler method is not ideal in my opinion. I
prefer to setup all my required dependencies on startup of the module and so
can throw the appropriate exceptions at that point.
 
ta,
Paul

  _____  

From: Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com] 
Sent: 30 December 2008 02:33
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers





On Mon, Dec 29, 2008 at 7:38 PM, Paul French <pa...@kirona.com> wrote:


Unfortunatley you cannot. The module.init() method is called after the
handler.init() methods and so any setup you do in the module init is not
available to the handlers.

Module init() is called after handler init(). but those init methods are
called before each handler get invoked. Therefore what ever you initialized
and put to the configuration context is available for handler invocations.
So the normal way is to initialize what ever in the module init() method
which are required in handler invocations.
Anyway I am not clear about your requirement.


In the end I created my resources in the module constructor since the module
class is instantiated before the handlers.

For example I initialise Spring as follows:
 
  public ModuleLogger()
  {
    String[] contexts = new String[] {"logging_module_spring.xml"};
    ClassPathXmlApplicationContext ac = new
ClassPathXmlApplicationContext(contexts,false);
    ac.setClassLoader(this.getClass().getClassLoader());
    ac.refresh();
  }

Then in the handler.init() method I obtain the spring context from the
ApplicationContextHolder and grab all resources required to support the
handler e.g. DataSource


If you use spring please look at here[1]. you can initialize things at the
startup method. It is worth to note that all these initializing methods are
happened at deployment time. and hence before processing any requests.

thanks,
Amila.


[1]http://ws.apache.org/axis2/1_4_1/spring.html 



 
Cheers,
Paul
 
  _____  

From: Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com] 
Sent: 29 December 2008 05:29 

To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers





On Sun, Dec 28, 2008 at 11:53 PM, Paul French <pa...@kirona.com>
wrote:


The handler.init method is not passed the configuration context. So I
suppose I have to obtain the resources on each invocation of the invoke or
revoke method of the handler. Being a big Spring fan I was looking for a way
to configure my module and handlers up front.


you have to use the module init method. write a class  which implements the
Module interface and declare it 
in the module.xml.

<module name="moduleName" class="moduleClass">

thanks,
Amila.




Thanks


-----Original Message-----
From: Deepal jayasinghe [mailto:deepalk@gmail.com]
Sent: 28 December 2008 17:47
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers

Paul French wrote:
> I have written a simple Module that logs all SOAP messages into a
> database.
>
> My handlers needs access to resources setup in the Module init method
> e.g a DataSource
>
> I cannot see how a handler can get access to resources setup in the
> module? Can someone give me a clue?
At the initialization put the resources into the ConfigurationContext, and
then you can access at the runtime

Deepal
>
> Thanks
> Paul
>
>


--
Thank you!


http://blogs.deepal.org
http://deepal.org



__________ NOD32 3719 (20081227) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com







-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/





-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/


Re: Modules and Handlers

Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Dec 29, 2008 at 7:38 PM, Paul French <pa...@kirona.com> wrote:

>  Unfortunatley you cannot. The module.init() method is called after the
> handler.init() methods and so any setup you do in the module init is not
> available to the handlers.
>
Module init() is called after handler init(). but those init methods are
called before each handler get invoked. Therefore what ever you initialized
and put to the configuration context is available for handler invocations.
So the normal way is to initialize what ever in the module init() method
which are required in handler invocations.
Anyway I am not clear about your requirement.

> In the end I created my resources in the module constructor since the
> module class is instantiated before the handlers.
> For example I initialise Spring as follows:
>
>   public ModuleLogger()
>   {
>     String[] contexts = new String[] {"logging_module_spring.xml"};
>     ClassPathXmlApplicationContext ac = new
> ClassPathXmlApplicationContext(contexts,false);
>     ac.setClassLoader(this.getClass().getClassLoader());
>     ac.refresh();
>   }
> Then in the handler.init() method I obtain the spring context from the
> ApplicationContextHolder and grab all resources required to support the
> handler e.g. DataSource
>

If you use spring please look at here[1]. you can initialize things at the
startup method. It is worth to note that all these initializing methods are
happened at deployment time. and hence before processing any requests.

thanks,
Amila.


[1]http://ws.apache.org/axis2/1_4_1/spring.html

>
> Cheers,
> Paul
>
>  ------------------------------
> *From:* Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com]
> *Sent:* 29 December 2008 05:29
>
> *To:* axis-user@ws.apache.org
> *Subject:* Re: Modules and Handlers
>
>
>
> On Sun, Dec 28, 2008 at 11:53 PM, Paul French <pa...@kirona.com>wrote:
>
>> The handler.init method is not passed the configuration context. So I
>> suppose I have to obtain the resources on each invocation of the invoke or
>> revoke method of the handler. Being a big Spring fan I was looking for a
>> way
>> to configure my module and handlers up front.
>
>
> you have to use the module init method. write a class  which implements the
> Module interface and declare it
> in the module.xml.
>
> <module name="moduleName" class="moduleClass">
>
> thanks,
> Amila.
>
>>
>>
>> Thanks
>>
>> -----Original Message-----
>> From: Deepal jayasinghe [mailto:deepalk@gmail.com]
>> Sent: 28 December 2008 17:47
>> To: axis-user@ws.apache.org
>> Subject: Re: Modules and Handlers
>>
>> Paul French wrote:
>> > I have written a simple Module that logs all SOAP messages into a
>> > database.
>> >
>> > My handlers needs access to resources setup in the Module init method
>> > e.g a DataSource
>> >
>> > I cannot see how a handler can get access to resources setup in the
>> > module? Can someone give me a clue?
>> At the initialization put the resources into the ConfigurationContext, and
>> then you can access at the runtime
>>
>> Deepal
>> >
>> > Thanks
>> > Paul
>> >
>> >
>>
>>
>> --
>> Thank you!
>>
>>
>> http://blogs.deepal.org
>> http://deepal.org
>>
>>
>> __________ NOD32 3719 (20081227) Information __________
>>
>> This message was checked by NOD32 antivirus system.
>> http://www.eset.com
>>
>>
>>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

RE: Modules and Handlers

Posted by Paul French <pa...@kirona.com>.
Unfortunatley you cannot. The module.init() method is called after the
handler.init() methods and so any setup you do in the module init is not
available to the handlers. In the end I created my resources in the module
constructor since the module class is instantiated before the handlers.

For example I initialise Spring as follows:
 
  public ModuleLogger()
  {
    String[] contexts = new String[] {"logging_module_spring.xml"};
    ClassPathXmlApplicationContext ac = new
ClassPathXmlApplicationContext(contexts,false);
    ac.setClassLoader(this.getClass().getClassLoader());
    ac.refresh();
  }

Then in the handler.init() method I obtain the spring context from the
ApplicationContextHolder and grab all resources required to support the
handler e.g. DataSource
 
Cheers,
Paul
 
  _____  

From: Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com] 
Sent: 29 December 2008 05:29
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers





On Sun, Dec 28, 2008 at 11:53 PM, Paul French <pa...@kirona.com>
wrote:


The handler.init method is not passed the configuration context. So I
suppose I have to obtain the resources on each invocation of the invoke or
revoke method of the handler. Being a big Spring fan I was looking for a way
to configure my module and handlers up front.


you have to use the module init method. write a class  which implements the
Module interface and declare it 
in the module.xml.

<module name="moduleName" class="moduleClass">

thanks,
Amila.




Thanks


-----Original Message-----
From: Deepal jayasinghe [mailto:deepalk@gmail.com]
Sent: 28 December 2008 17:47
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers

Paul French wrote:
> I have written a simple Module that logs all SOAP messages into a
> database.
>
> My handlers needs access to resources setup in the Module init method
> e.g a DataSource
>
> I cannot see how a handler can get access to resources setup in the
> module? Can someone give me a clue?
At the initialization put the resources into the ConfigurationContext, and
then you can access at the runtime

Deepal
>
> Thanks
> Paul
>
>


--
Thank you!


http://blogs.deepal.org
http://deepal.org



__________ NOD32 3719 (20081227) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com







-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/


Re: Modules and Handlers

Posted by Amila Suriarachchi <am...@gmail.com>.
On Sun, Dec 28, 2008 at 11:53 PM, Paul French <pa...@kirona.com>wrote:

> The handler.init method is not passed the configuration context. So I
> suppose I have to obtain the resources on each invocation of the invoke or
> revoke method of the handler. Being a big Spring fan I was looking for a
> way
> to configure my module and handlers up front.


you have to use the module init method. write a class  which implements the
Module interface and declare it
in the module.xml.

<module name="moduleName" class="moduleClass">

thanks,
Amila.

>
>
> Thanks
>
> -----Original Message-----
> From: Deepal jayasinghe [mailto:deepalk@gmail.com]
> Sent: 28 December 2008 17:47
> To: axis-user@ws.apache.org
> Subject: Re: Modules and Handlers
>
> Paul French wrote:
> > I have written a simple Module that logs all SOAP messages into a
> > database.
> >
> > My handlers needs access to resources setup in the Module init method
> > e.g a DataSource
> >
> > I cannot see how a handler can get access to resources setup in the
> > module? Can someone give me a clue?
> At the initialization put the resources into the ConfigurationContext, and
> then you can access at the runtime
>
> Deepal
> >
> > Thanks
> > Paul
> >
> >
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> __________ NOD32 3719 (20081227) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Modules and Handlers

Posted by Deepal jayasinghe <de...@gmail.com>.
Paul French wrote:
> The handler.init method is not passed the configuration context. So I
> suppose I have to obtain the resources on each invocation of the invoke or
> revoke method of the handler. Being a big Spring fan I was looking for a way
> to configure my module and handlers up front.
>   
Yes that should be the case, because handlers are said to be stateless.
So you are not supposed to store anything inside a handler.
You can do the initialization at the startup time and store into the
configuration context and use that at the runtime.

Thank you!
Deepal
> Thanks
>
> -----Original Message-----
> From: Deepal jayasinghe [mailto:deepalk@gmail.com] 
> Sent: 28 December 2008 17:47
> To: axis-user@ws.apache.org
> Subject: Re: Modules and Handlers
>
> Paul French wrote:
>   
>> I have written a simple Module that logs all SOAP messages into a 
>> database.
>>  
>> My handlers needs access to resources setup in the Module init method 
>> e.g a DataSource
>>  
>> I cannot see how a handler can get access to resources setup in the 
>> module? Can someone give me a clue?
>>     
> At the initialization put the resources into the ConfigurationContext, and
> then you can access at the runtime
>
> Deepal
>   
>>  
>> Thanks
>> Paul
>>  
>>  
>>     
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>
> __________ NOD32 3719 (20081227) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


RE: Modules and Handlers

Posted by Paul French <pa...@kirona.com>.
The handler.init method is not passed the configuration context. So I
suppose I have to obtain the resources on each invocation of the invoke or
revoke method of the handler. Being a big Spring fan I was looking for a way
to configure my module and handlers up front.

Thanks

-----Original Message-----
From: Deepal jayasinghe [mailto:deepalk@gmail.com] 
Sent: 28 December 2008 17:47
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers

Paul French wrote:
> I have written a simple Module that logs all SOAP messages into a 
> database.
>  
> My handlers needs access to resources setup in the Module init method 
> e.g a DataSource
>  
> I cannot see how a handler can get access to resources setup in the 
> module? Can someone give me a clue?
At the initialization put the resources into the ConfigurationContext, and
then you can access at the runtime

Deepal
>  
> Thanks
> Paul
>  
>  


--
Thank you!


http://blogs.deepal.org
http://deepal.org


__________ NOD32 3719 (20081227) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



Re: Modules and Handlers

Posted by Deepal jayasinghe <de...@gmail.com>.
Paul French wrote:
> I have written a simple Module that logs all SOAP messages into a
> database.
>  
> My handlers needs access to resources setup in the Module init method
> e.g a DataSource
>  
> I cannot see how a handler can get access to resources setup in the
> module? Can someone give me a clue?
At the initialization put the resources into the ConfigurationContext,
and then you can access at the runtime

Deepal
>  
> Thanks
> Paul
>  
>  


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org