Forum Discussion
Kumar_107292
Nimbostratus
Feb 19, 2013How do I use sessions in Icontrol API using java.
How do I use sessions in Icontrol API using java.
I have got the iControl Interface object. Then from the interface object I am getting the session object.
Now My question is How do I make ...
Ryan_Lamore_804
Nimbostratus
Jun 03, 2013Did you figure this out? I thought it was as simple as setting the session header, but it took me forever to get this to work. The tricky part was finding the right namespace. See the code below:
-----
SystemSessionBindingStub systemSessionStub1 = new Interfaces(config.host11(), config.user(), config.password()).getSystemSession();
Long sessionId1 = systemSessionStub1.get_session_identifier();
systemSessionStub1.setHeader("urn:iControl", "session", sessionId1.toString());
systemSessionStub1.set_session_timeout(300);
systemSessionStub1.set_active_folder("/Common");
SystemSessionBindingStub systemSessionStub2 = new Interfaces(config.host11(), config.user(), config.password()).getSystemSession();
Long sessionId2 = systemSessionStub2.get_session_identifier();
systemSessionStub2.setHeader("urn:iControl", "session", sessionId2.toString());
systemSessionStub2.set_session_timeout(300);
systemSessionStub2.set_active_folder("/Common");
systemSessionStub1.start_transaction();
try {
systemSessionStub2.start_transaction();
logger.debug("Opened two transactions!");
systemSessionStub2.rollback_transaction();
} catch (Exception e) {
Assert.fail("Couldn't create two transactions at the same time.", e);
} finally {
systemSessionStub1.rollback_transaction();
}
-----
Hopefully this saves someone the wasted time trying to debug this. Perhaps we should move this code near the API documentation?
Ryan
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects