I've tried the below and was hitting the problem as mentioned in a previous
email.
Why is it, that in my service class, if I just do
XXResource x = (XXResource) getResourceContext().getResource();
Why is this error given? (below). IE why is a resource not found exceptio
nthrown? What steps do I have to do to ensure a resource is instantiated? Or
created somehow? I am supplying a resource ID in my request message.
I have even played around with the "createInstance" method line in the
getInstance method of the XXHome class. But it doesn't seem to make a
difference.
Please help! Thanks!
Shahzad
--> 03-17-05 23:47:08 DEBUG [http-8080-Processor24] ProjectResourceBundle:
org.apache.ws.util.i18n.resource::handleGetObject(RELEASE_LCK)
--> 03-17-05 23:47:08 DEBUG [http-8080-Processor24] Lock: Releasing lock.
--> 03-17-05 23:47:08 DEBUG [http-8080-Processor24] ProjectResourceBundle:
org.apache.ws.util.i18n.resource::handleGetObject(REMOVING_LCK_FOR_KEY)
--> 03-17-05 23:47:08 DEBUG [http-8080-Processor24] LockManager: Removing
Lock for key: {http://ShibbolethBrowserSession}ResourceID=1
(type=java.lang.String)
org.apache.ws.resource.ResourceUnknownException
at
org.apache.ws.resource.impl.AbstractResourceHome.get(AbstractResourceHome.ja
va:548)
at
org.apache.ws.resource.impl.AbstractResourceHome.find(AbstractResourceHome.j
ava:306)
at
org.apache.ws.resource.impl.AbstractResourceContext.getResource(AbstractReso
urceContext.java:166)
at
shibbolethBrowserSession.ShibbolethBrowserSessionService.HSLogin(ShibbolethB
rowserSessionService.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler
.java:157)
at
org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider
.java:203)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:450)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
-----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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]