Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"

oz jack

+ Follow
since Jan 29, 2019
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by oz jack

Hi All,
      I will use JAXWS to expose a web service from a java method. However, the class contains a static main method and another method that needs to called before the service method. I am not sure how to refactor the methods in the class to enable me to expose the method "serviceMethod" as a web service.

Basically want to refactor the standalone java program and expose as a webservice. Please advise.

public class EpmQuery {
   public EpmQuery() {
   public void execute() throws HFMException, Exception {
       //Create app
       Application app = new Application();

       //Retrieve loaded metadata
       Metadata metadata = new Metadata();

       //Get all the clusters
       Cluster cluster = new Cluster();

       //Get the available cluster
       String strCluster = cluster.getAvailableCluster(app.getSsoToken());

       //Get all Servers
       String server = cluster.enumServers(strCluster);

       //Get all applications
       app.getApplications(strCluster, app.getSsoToken(), Locale.ENGLISH.getLanguage());

       String result = serviceMethod("S#Actual.Y#2005.P#January.W#<Scenario View>")


public String serviceMethod(String pov) throws HFMException{
   DataCell dataCell = new DataCell();
        return dataCell.readDataCell(pov);


   public static void main(String[] args) {
       try {

           String epmOracleInstance = System.getProperty("EPM_ORACLE_INSTANCE");

           if (epmOracleInstance == null || epmOracleInstance.isEmpty()) {
               throw new Exception("EPM Instance home not set");


           //Execute the demo application
           //This will create a new application, load metadata and print metadata
           EpmQuery epmq = new EpmQuery();

       } catch (HFMException e) {
           //Get error details
           System.exit( -1 );
       } catch (Exception e) {
           System.exit( -1 );

2 weeks ago