• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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

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() {
   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 );

You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
Enterprise Java integration with Delphi and Free Pascal applications - new release 2019.02
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!