Re: Fw: Axis2 session management (yes, I know that subject is a bit worn-out)

2008-02-20 Thread Benoît Smith
Just a thought : is it problematic that the SOAP envelope of the response
message context doesn't have a header ?

Benoît


Selon Benoît Smith [EMAIL PROTECTED]:

 Here is my service configuration :

 serviceGroup

   !-- Sample --

   service name=sample scope=soapsession
   messageReceivers
   messageReceiver
   mep=http://www.w3.org/2004/08/wsdl/in-out;
   
 class=org.apache.axis2.rpc.receivers.RPCMessageReceiver
   /
   messageReceiver
   mep=http://www.w3.org/2004/08/wsdl/in-only;
   
 class=org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver
   /
   /messageReceivers
   parameter name=ServiceClass
 locked=falsefr.axis2ws.wsmobile.SampleService/parameter
   operation name=getResult 
 mep=http://www.w3.org/2004/08/wsdl/in-out;
   actionMappingurn:getResult/actionMapping
   /operation
   /service

   !-- Other services --
   ...

 /serviceGroup


 Here is my service source code :


 package fr.axis2ws.wsmobile;

 /* Various imports */

 public abstract class SampleService
 {
 private static Logger logger = Logger.getLogger(SampleService.class);

 private Member member = null;

 private String sessionId = null;

 /**
  * @param sc
  * @throws SampleInitException
  */
 public void init (ServiceContext sc) throws SampleInitException {
 try {
 if (this.member == null) {
 if (this.idSession == null) {
 this.idSession = sc.getServiceGroupContext().getId();
 }
 this.member =
 (Member)sc.getServiceGroupContext().getProperty(Const.MEMBER);
 if (this.member == null) {
 this.member = new Member();

 sc.getServiceGroupContext().setProperty(Const.MEMBER,
 this.member);
 }
 }
 } catch (Throwable t) {
 logger.error(Init error, t);
 throw new SampleInitException(Init error, t);
 }
 }

 /**
  * @param sc
  * @throws SampleInitException
  */
 public void destroy (ServiceContext sc) throws SampleInitException {
 logger.info(Destroy);
 }

 public SampleResponse getResult (long param) throws WsMobNoeudException {
 try {
 SampleResponse response;

 /* Some code */

   response = new SampleResponse(SampleResponse.SUCCESS, 
 this.sessionId);

 return response;
 }
 catch (Throwable t) {
 logger.error(Failure, t);
 throw new SampleException(Failure, t);
 }
   }
 }


 And here is the source code for creating a response object :


 /* Various imports */

 public class SampleResponse
 {
 public static int VOID = -1;
 public static int SUCCESS  = 0;
 public static int FAILURE  = 1;

 protected int errorCode = VOID;

 public SampleResponse (int errorCode, String sessionId) {
 this.errorCode = errorCode;
 this.sessionId = sessionId;
 }

 public String getSessionId () {
 return this.sessionId;
 }

 public int getErrorCode () {
 return this.errorCode;
 }
 }


 Thank you.

 Best regards,
 Benoît Smith


 Selon Martin Gainty [EMAIL PROTECTED]:

  when unspecified the default scope is session scope so taking a quick look
  at the code to generate the id for your Session
   GetResult gr = new GetResult();
   gr.setParam(-1);
   GetResultResponse reponse = stub.getResult(gr);
   idSession = reponse.get_return().getIdSession();
 
  there appears to be some malady in either
  GetResultResponse
  OR
  GetResult
 
  can you display the contents of the classes to group?
 
  Thanks
  Martin--
 
  - Original Message -
  From: Michele Mazzucco [EMAIL PROTECTED]
  To: axis-user@ws.apache.org
  Sent: Monday, February 18, 2008 4:36 AM
  Subject: Re: Axis2 session management (yes, I know that subject is a bit
  worn-out)
 
 
  Benoît,
 
 
  my guess is that the service must be configured in session scope.
 
 
  Michele
 
  On 18 Feb 2008, at 08:38, Benoît Smith wrote:
 
   Greetings,
  
   I'm a clear newbie to Axis2, and I'm aware that the question I'm
   asking has
   already been asked in many forms before. The thing is, none of the
   solutions
   appeared to solve my specific problem. So I'll try to be as
   accurate as
   possible.
  
   My objectives :
   Run some Axis2 web services on a Tomcat servlet container, and
   access them with
   a *remote* client, using session management.
  
   Server-side configuration :
   - Axis2 1.2 (for compatibility 

Re: Fw: Axis2 session management (yes, I know that subject is a bit worn-out)

2008-02-19 Thread Benoît Smith
Here is my service configuration :

serviceGroup

!-- Sample --

service name=sample scope=soapsession
messageReceivers
messageReceiver
mep=http://www.w3.org/2004/08/wsdl/in-out;

class=org.apache.axis2.rpc.receivers.RPCMessageReceiver
/
messageReceiver
mep=http://www.w3.org/2004/08/wsdl/in-only;

class=org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver
/
/messageReceivers
parameter name=ServiceClass
locked=falsefr.axis2ws.wsmobile.SampleService/parameter
operation name=getResult 
mep=http://www.w3.org/2004/08/wsdl/in-out;
actionMappingurn:getResult/actionMapping
/operation
/service

!-- Other services --
...

/serviceGroup


Here is my service source code :


package fr.axis2ws.wsmobile;

/* Various imports */

public abstract class SampleService
{
private static Logger logger = Logger.getLogger(SampleService.class);

private Member member = null;

private String sessionId = null;

/**
 * @param sc
 * @throws SampleInitException
 */
public void init (ServiceContext sc) throws SampleInitException {
try {
if (this.member == null) {
if (this.idSession == null) {
this.idSession = sc.getServiceGroupContext().getId();
}
this.member =
(Member)sc.getServiceGroupContext().getProperty(Const.MEMBER);
if (this.member == null) {
this.member = new Member();

sc.getServiceGroupContext().setProperty(Const.MEMBER,
this.member);
}
}
} catch (Throwable t) {
logger.error(Init error, t);
throw new SampleInitException(Init error, t);
}
}

/**
 * @param sc
 * @throws SampleInitException
 */
public void destroy (ServiceContext sc) throws SampleInitException {
logger.info(Destroy);
}

public SampleResponse getResult (long param) throws WsMobNoeudException {
try {
SampleResponse response;

/* Some code */

response = new SampleResponse(SampleResponse.SUCCESS, 
this.sessionId);

return response;
}
catch (Throwable t) {
logger.error(Failure, t);
throw new SampleException(Failure, t);
}
}
}


And here is the source code for creating a response object :


/* Various imports */

public class SampleResponse
{
public static int VOID = -1;
public static int SUCCESS  = 0;
public static int FAILURE  = 1;

protected int errorCode = VOID;

public SampleResponse (int errorCode, String sessionId) {
this.errorCode = errorCode;
this.sessionId = sessionId;
}

public String getSessionId () {
return this.sessionId;
}

public int getErrorCode () {
return this.errorCode;
}
}


Thank you.

Best regards,
Benoît Smith


Selon Martin Gainty [EMAIL PROTECTED]:

 when unspecified the default scope is session scope so taking a quick look
 at the code to generate the id for your Session
  GetResult gr = new GetResult();
  gr.setParam(-1);
  GetResultResponse reponse = stub.getResult(gr);
  idSession = reponse.get_return().getIdSession();

 there appears to be some malady in either
 GetResultResponse
 OR
 GetResult

 can you display the contents of the classes to group?

 Thanks
 Martin--

 - Original Message -
 From: Michele Mazzucco [EMAIL PROTECTED]
 To: axis-user@ws.apache.org
 Sent: Monday, February 18, 2008 4:36 AM
 Subject: Re: Axis2 session management (yes, I know that subject is a bit
 worn-out)


 Benoît,


 my guess is that the service must be configured in session scope.


 Michele

 On 18 Feb 2008, at 08:38, Benoît Smith wrote:

  Greetings,
 
  I'm a clear newbie to Axis2, and I'm aware that the question I'm
  asking has
  already been asked in many forms before. The thing is, none of the
  solutions
  appeared to solve my specific problem. So I'll try to be as
  accurate as
  possible.
 
  My objectives :
  Run some Axis2 web services on a Tomcat servlet container, and
  access them with
  a *remote* client, using session management.
 
  Server-side configuration :
  - Axis2 1.2 (for compatibility reasons, I have to stick with 1.2),
  installed as
  a component on a Tomcat 6.0.14 servlet container.
  - axis2.xml configured by default. The Addressing module seems well
  engaged.
  - The SampleService I wrote includes a 'sessionId' value in its
  responses. That