Thank you, Harsha!  It worked.

For whoever else might need this information, see below for an example.

-Boris

Example: if using Maven, just add:

        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.webapp.mgt.stub</artifactId>
            <version>4.0.1</version>
        </dependency>

then the following code snippet can be used to obtain an instance of
WebappAdminStub to access the needed functionality:

            // wso2Url is the WSO2 services EPR, for example:
https://localhost:9443/services/
            String authAdminEPR = wso2Url + "AuthenticationAdmin";
            String remoteAddress = NetworkUtils.getLocalHostname();

            ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
null);
            AuthenticationAdminStub adminStub = new
AuthenticationAdminStub(configContext, authAdminEPR);
           
adminStub._getServiceClient().getOptions().setManageSession(true);
            if (!adminStub.login(wso2User, wso2Password, remoteAddress))
                throw new AuthenticationException("Invalid username and/or
password");

            String authCookie = (String)
adminStub._getServiceClient().getServiceContext().getProperty(HTTPConstants.COOKIE_STRING);

            String webappAdminEPR = wso2Url + "WebappAdmin";
            WebappAdminStub webappAdminStub = new
WebappAdminStub(configContext, webappAdminEPR);
            Options option =
webappAdminStub._getServiceClient().getOptions();
            option.setManageSession(true);
            option.setProperty(HTTPConstants.COOKIE_STRING, authCookie);

            // now webappAdminStub can be used, as needed




--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/AS-programmatic-webapp-deployment-tp76821p76823.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to