Hi Shahzad,
You need to add the following to XXXAbstractService and XXXService:
public XXXAbstractService( ResourceContext resourceContext )
{
super( resourceContext );
}Note, it's on our TODO list to make Wsdl2Java generate all services as extending AbstractPortType, so these manual changes will no longer be necessary.
Regards, Ian
Shahzad Younas wrote:
Hi,
Thanks for the info guys. Nice and clear instructions! That's some good stuff! When I try and make my XXXAbstractService class that was generated extend AbstractPortType, my compiler starts saying that I need a super constructor in both my AbstractService and my Service class.
What code do I need to put in these? I added a default constructor, but then it crashed on me!
Also, in the WSDL, is there no standard way to specify a method to accept a single "<CREATE>" tag, and for it to create an instance of the resource and return the resource ID? I am sure this is a fucntionality of the Wsdl2Java task to generate the specific methods to do this.
I tried adapting bits of the "CreatePrinter" example to allow mine to create instances, but it failed miserably.
Thanks in advance!
Shahzad
-----Original Message-----
From: Ian Springer [mailto:[EMAIL PROTECTED] Sent: 17 March 2005 17:35
To: [email protected]
Subject: Re: Instance Problem..
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]
