• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Refactor/create a webservice from a java method in a class  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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() {
       super();
   }
   
   
   public void execute() throws HFMException, Exception {
       //Create app
       Application app = new Application();
             

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

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

       //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();
           epmq.execute();

       } catch (HFMException e) {
           e.printStackTrace();
           //Get error details
           System.out.println(e.getErrorCode());
           System.out.println(e.getHResult());
           System.out.println(e.getLocalizedMessage(Locale.ENGLISH));
           System.exit( -1 );
       } catch (Exception e) {
           e.printStackTrace();
           System.exit( -1 );
       }
   }
}



 
please buy my thing and then I'll have more money:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!