Hi Shahzad,

Good question. We've had other questions along these lines, so we definitely need to clarify this in the tutorial.

The Service is stateless, but for each resource instance, a Resource is created which is stateful. The Resource contains the ResourcePropertySet but may also contain additional state (i.e. member vars). Try the following:

Make the XXXAbstractService class that was generated extend AbstractPortType. Then you can do something like:

class XXXService
{
ResponseDocument addOne(RequestDocument)
{
getResource().incrementCounter();
return new ResponseDocument(getResource().getCounter())
} }


class XXXResource
{
  private int m_counter;

  public void incrementCounter()
  {
      m_counter++;
  }

  public int getCounter()
  {
      return m_counter;
  }
}

Shahzad Younas wrote:

Hi,
I was wondering, lets say I have a method in my service class:
class Service
{
private int tmp=1;
ResponseDocument addOne(RequestDocument)
{
tmp++;
return new ResponseDocument(with a field containing "tmp")
} }
if i call this method once (for a given resource ID) (by call, i mean send a SOAP Request containing the RequestDocument) , i will get a value of 2 returned.
Ifi call it again, with the same resource ID, will i get a value of 3 returned? IE by state, do we mean that all variables for the service are preserved for each resource ID?
I am abit confused. I know ResourceProperties should hold stateful values, but I need for the service private variables to be maintained too.
Thanks
Shahzad



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to