I have deployed axis on jboss.I am getting problem with static variable.When
I am running the test case this variable is getting cached.Is there any way
to disable this caching.I have tried deploying axis on weblogic but getting
same problem.The corresponding files and classes I have created is as below,

WSDL File
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:createContext"
xmlns:impl="urn:createContext" xmlns:intf="urn:createContext"
xmlns:apachesoap="http://xml.apache.org/xml-soap";
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
<!--WSDL created by Apache Axis version: #axisVersion#
Built on #today#-->

   <wsdl:message name="incResponse">

   </wsdl:message>

   <wsdl:message name="incRequest">

   </wsdl:message>

   <wsdl:portType name="TestWS">

      <wsdl:operation name="inc">

         <wsdl:input name="incRequest" message="impl:incRequest"/>

         <wsdl:output name="incResponse" message="impl:incResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="PROSoapBinding" type="impl:TestWS">

      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="inc">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="incRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="incResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TestWSService">

      <wsdl:port name="PRO" binding="impl:PROSoapBinding">

         <wsdlsoap:address
location="http://localhost:7001/axis/services/PRO"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

Deployment descriptor,
<deployment
    xmlns="http://xml.apache.org/axis/wsdd/";
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>

  <!-- Services from TestWSService WSDL service -->

  <service name="PRO" provider="java:RPC" style="document" use="literal">
      <parameter name="wsdlTargetNamespace" value="urn:createContext"/>
      <parameter name="wsdlServiceElement" value="TestWSService"/>
      <parameter name="wsdlServicePort" value="PRO"/>
      <parameter name="className"
value="createContext.PROSoapBindingSkeleton"/>
      <parameter name="wsdlPortType" value="TestWS"/>
      <parameter name="typeMappingVersion" value="1.2"/>
      <parameter name="allowedMethods" value="*"/>
      <parameter name="scope" value="Session"/>

  </service>
</deployment>

The impl class
import com.test.TestStatic;

public class PROSoapBindingImpl implements createContext.TestWS{
    public void inc() throws java.rmi.RemoteException {
      TestStatic test = new TestStatic();
      test.inc();
    }

}

TestStatic.java
public class TestStatic {
  private static int test = 1;
  public void inc() {
    test++;
    System.out.println("Test: " + test);
  }
}

The test class,
public class TestWebservice {
  public static void main(String[] s) {
    TestWebservice test1 = new TestWebservice();
    test1.test(); 
  }
  public void test() {
    System.out.println("******************start*********"); 
    TestWS service = null;
    TestWSServiceLocator locator = new TestWSServiceLocator();
  try {
    service = locator.getPRO();
    PROSoapBindingStub stub = (PROSoapBindingStub)service;
    stub.setUsername("system");
    stub.setPassword("password");
    
    stub.inc(); 
  } catch(Exception e){
    e.printStackTrace(); 
  }
  System.out.println("******************end*********");
  }

When I am running the test case first time I get the value of test variable
2 as expected.When I am running this test case second time I am getting the
value 3.If applcation server restarted I am getting same result i.e first
time 2 and second time 3.I have generated classes using wsdltojava tools.

Is this is the bug in axis or I should det some property to disable this
catching of static variable

Thanks in advance,

Sanjay


--
View this message in context: 
http://www.nabble.com/Static-variable-cache-t1392713.html#a3743260
Sent from the Axis - User forum at Nabble.com.

Reply via email to