You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Ri...@exe.com on 2000/08/03 21:27:40 UTC
Re: How is the state preserved ?
If i should be application-specific, it should be stored on the application and
sent/recieved as needed (IMO anyway) keeping the SOAP services stateless (as
true services should be, also IMO). If its valid for the state of a single run,
it should go out of scope before the method ends.
Remember, you have (in this case) one instance of the Abb class being
instantiated to handle multiple requests -- one of the main advantages of a
service-based system. Depending on your servlet-server, you could even have a
many:few relationship between requests and servers. Basically, my
recommendation is, "Don't do that."
-Richard
Rocky Raccoon <rr...@bigfoot.com> on 08/03/2000 03:24:08 PM
Please respond to soap-user@xml.apache.org
To: Soap <so...@xml.apache.org>
cc: (bcc: Richard Stanford/EXE)
Subject: How is the state preserved ?
This is my soap service class.
public class Abb
{
private int i = 0;
public String hw()
{
++i;
return "Hello World" + i ;
}
}
This is my deployment descriptor.
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:AFetcher">
<isd:provider type="java"
scope="Application"
methods="hw">
<isd:java class="samples.hworld.Abb" static="false"/>
</isd:provider>
</isd:service>
In my client code, I don't use a BeanSerializer
SOAPMappingRegistry smr = new SOAPMappingRegistry();
// Map the types.
smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
QName("urn:ibm-soap-mine-demo",
"mine"), Abb.class, null,null);
In spite of this the value of "i" persists across different runs of the
same application.
(i.e. I shutdown the client & re-run it).
It persists even if I un-deploy the SOAP service & redeploy it.
It loses its state only if I shutdown TOMCAT.
How does this happen ?
How do I prevent it ?
What I want is to create 2 different Abb objects each with it's own
value of "i".
Rocky.