Hi Hiranya;
Please have a look at [1] - it does exactly what you want to do.
If you are using stubs, you need to load the same configuration into
both the stubs while initializing - I guess that is the issue in your code.
Thanks & regards.
-Prabath
[1]:http://blog.facilelogin.com/2008/11/axis2-session-management-transport.html
Hiranya Jayathilaka wrote:
Hi Keith,
Thanks for the quick reply. I checked the LoginResponse interface and
it seems there is no way to retrieve the cookie from it (at least
there is no method which directly returns the cookie). Can you explain
a bit more how to do this? Also how do I set the cookie in the
subsequent invocations?
Thanks
Best Regards,
Hiranya
On Tue, Dec 16, 2008 at 3:33 PM, Keith Chapman <[email protected]
<mailto:[email protected]>> wrote:
Hi,
AFAIK setManageSession works within the scope of a stub. That is
you can
invoke several operations in a service within a single session.
Here the
case is different. Tho services are different and Axis2 is not
preserving the session cookie for you.
The workaround would be this.
1' Invoke the login method.
2. get the cookie from the response
3. Set the cookie manually during subsequent invocations of
ServerAdmin
:).
Thanks,
Keith.
Hiranya Jayathilaka wrote:
> Hi Folks,
>
> We are trying to develop a client for the WSAS admin services (WSAS
> version is 2.3). We want to invoke the restart operation of the
> ServerAdmin service using a client. So we used WSDL2Code to generate
> the necessary stubs for the GlobalAdmin and ServerAdmin
services. Then
> using the GlobalAdmin client we are able to login to WSAS. Now
we want
> to restart the server using the established session. How can we do
> this in our code. We tried the following but it didn't work.
>
> String path = System.getProperty("user.dir");
> System.setProperty("javax.net.ssl.trustStore", path +
> "/src/wso2wsas.jks");
> System.getProperty("javax.net.ssl.trustStorePassword",
> "wso2wsas");
> GlobalAdminStub gStub = new GlobalAdminStub();
> Options options = gStub._getServiceClient().getOptions();
> options.setManageSession(true);
> Login login = new Login();
> login.setUsername("admin");
> login.setPassword("admin");
>
> if (gStub.login(login).get_return()) {
> ServerAdminStub stub = new ServerAdminStub(cfgCtx);
>
stub._getServiceClient().getOptions().setManageSession(true);
> stub.restart();
> }
>
> This code returns the following exception.
>
> Exception in thread "main" org.apache.axis2.AxisFault: Access
Denied.
> Please login first.
> at
>
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
> at
>
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
> at
>
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
> at
>
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
> at
>
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> at
>
org.wso2.wsas.admin.service.ServerAdminStub.restart(ServerAdminStub.java:193)
> at org.moinc.server.test.WSASHandler.main(WSASHandler.java:29)
>
> According to the WSAS logs the login attempt has been
successful. But
> the restart operation has failed. Can somebody please help me figure
> out the correct way to do this?
>
> Thanks
>
> Best Regards,
> Hiranya
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> Wsas-java-dev mailing list
> [email protected] <mailto:[email protected]>
> https://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
>
_______________________________________________
Wsas-java-dev mailing list
[email protected] <mailto:[email protected]>
https://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
------------------------------------------------------------------------
_______________________________________________
Wsas-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.9.18/1850 - Release Date: 12/15/2008 5:04 PM
_______________________________________________
Wsas-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev