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 Tony HEDOUX <he...@hotmail.com> on 2011/06/24 14:12:59 UTC

destroy(ServiceContext context) never call

Hi,

I am running a simple WebService with Axis 1.5.4, who send a String msg.

My Axis2.xml :

<service name="SimpleTest" >
    <Description>
        Please Type your service description here
    </Description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass" locked="false" scope="request">SimpleTest</parameter>
</service>

I have implemented lifeCycle init and destroy method : 

import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.service.Lifecycle;


public class SimpleTest implements Lifecycle{

    public void destroy(ServiceContext arg0) {
        System.out.println("destroy call");
    }
    
    public String ping(){
        return "bouh";
    }

    public void init(ServiceContext arg0) throws AxisFault {
        System.out.println("init call");
        
    }

}

Then, i have call my WS by web browser (http://localhost:8080/timeOut/services/SimpleTest/ping), and with a small client using auto generated stub : 

SimpleTestStub stb = new SimpleTestStub();
ServiceClient sc =    stb._getServiceClient();
sc.getOptions().setManageSession(true);
stb._setServiceClient(sc);
 System.out.println(stb.ping().get_return());

By reading api documentation, i think i should see an init call and a destroy call between each request, but in fact, i can only see (for each request) an init call.

What am i doing wrong?

Thx for help,

Tony.

 		 	   		  

RE: destroy(ServiceContext context) never call

Posted by Tony HEDOUX <he...@hotmail.com>.
thanks for the fix.
 Tony.Date: Fri, 24 Jun 2011 22:59:56 -0400
From: deepalk@gmail.com
To: java-user@axis.apache.org
Subject: Re: destroy(ServiceContext context) never call



  


    
  
  
    You were absolutely right, there was some missing code for calling
    destroy method for service deployed in request scope. I have fixed
    it in the trunk, you will get the fix in nightly builds.

    

    Deepal 

    
      
        Hi,

        

        I am running a simple WebService with Axis 1.5.4, who send a
        String msg.

        

        My Axis2.xml :

        

        <service name="SimpleTest" >

            <Description>

                Please Type your service description here

            </Description>

            <messageReceivers>

                <messageReceiver
        mep="http://www.w3.org/2004/08/wsdl/in-only"
        class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
        />

                <messageReceiver 
        mep="http://www.w3.org/2004/08/wsdl/in-out" 
        class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

            </messageReceivers>

            <parameter name="ServiceClass" locked="false" scope="request">SimpleTest</parameter>

        </service>

        

        I have implemented lifeCycle init and destroy method : 

        

        import org.apache.axis2.AxisFault;

          import org.apache.axis2.context.ServiceContext;

          import org.apache.axis2.service.Lifecycle;

          

          

          public class SimpleTest implements Lifecycle{

          

              public void destroy(ServiceContext arg0) {

                  System.out.println("destroy call");

              }

              

              public String ping(){

                  return "bouh";

              }

          

              public void init(ServiceContext arg0) throws AxisFault {

                  System.out.println("init call");

                  

              }

          

          }

          

        Then, i have call my WS by web browser
        (http://localhost:8080/timeOut/services/SimpleTest/ping), and
        with a small client using auto generated stub : 

        

        SimpleTestStub stb = new SimpleTestStub();

          ServiceClient sc =    stb._getServiceClient();

          sc.getOptions().setManageSession(true);

          stb._setServiceClient(sc);

           System.out.println(stb.ping().get_return());

        

        By reading api documentation, i think i should see an init call
        and a destroy call between each request, but in fact, i can only
        see (for each request) an init call.

        

        What am i doing wrong?

        

        Thx for help,

        

        Tony.

        

      
    
    
 		 	   		  

Re: destroy(ServiceContext context) never call

Posted by Deepal jayasinghe <de...@gmail.com>.
You were absolutely right, there was some missing code for calling
destroy method for service deployed in request scope. I have fixed it in
the trunk, you will get the fix in nightly builds.

Deepal
> Hi,
>
> I am running a simple WebService with Axis 1.5.4, who send a String msg.
>
> My Axis2.xml :
>
> <service name="SimpleTest" >
>     <Description>
>         Please Type your service description here
>     </Description>
>     <messageReceivers>
>         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>         <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out" 
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </messageReceivers>
>     <parameter name="ServiceClass" locked="false"
> *scope="request"*>SimpleTest</parameter>
> </service>
>
> I have implemented lifeCycle init and destroy method :
>
> *import org.apache.axis2.AxisFault;
> import org.apache.axis2.context.ServiceContext;
> import org.apache.axis2.service.Lifecycle;
>
>
> public class SimpleTest implements Lifecycle{
>
>     public void destroy(ServiceContext arg0) {
>         System.out.println("destroy call");
>     }
>    
>     public String ping(){
>         return "bouh";
>     }
>
>     public void init(ServiceContext arg0) throws AxisFault {
>         System.out.println("init call");
>        
>     }
>
> }
>
> *Then, i have call my WS by web browser
> (http://localhost:8080/timeOut/services/SimpleTest/ping), and with a
> small client using auto generated stub :
>
> *SimpleTestStub stb = new SimpleTestStub();
> ServiceClient sc =    stb._getServiceClient();
> sc.getOptions().setManageSession(true);
> stb._setServiceClient(sc);
>  System.out.println(stb.ping().get_return());*
>
> By reading api documentation, i think i should see an init call and a
> destroy call between each request, but in fact, i can only see (for
> each request) an init call.
>
> What am i doing wrong?
>
> Thx for help,
>
> Tony.
>