Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.indra.soap;
- import com.indra.Application.ApplicationManagementSoapBindingStub;
- import com.indra.Application.Output;
- import java.io.File;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.rmi.RemoteException;
- import java.util.Properties;
- import org.apache.log4j.PropertyConfigurator;
- /**
- *
- * @author User
- */
- public class Wrapper {
- private static Properties props = new Properties();
- public static final String ENV_CONFIG_HOME = "CATALINA_BASE";
- public static final String ENV_CONFIG_NAME = "conf";
- public static final String NAME_FILE_PROP = "ws.ini";
- private String wsUrl = "";
- private ApplicationManagementSoapBindingStub stub;
- public Wrapper(String url )
- {
- wsUrl=url;
- }
- private static boolean isNumeric(String str)
- {
- try
- {
- double d = Double.parseDouble(str);
- }
- catch(NumberFormatException nfe)
- {
- return false;
- }
- return true;
- }
- /**
- *
- * @param dnis
- * @return Output
- * */
- public Output applicationManagement(String dnis){
- Output out =null;
- String appo="";
- String config_path="";
- try
- {
- config_path = System.getenv(ENV_CONFIG_HOME);
- config_path += File.separator + ENV_CONFIG_NAME;
- config_path += File.separator + NAME_FILE_PROP;
- PropertyConfigurator.configure(config_path);
- appo = props.getProperty("APPLICATION_MANAGEMENT_Timeout");
- stub = new ApplicationManagementSoapBindingStub(new URL(wsUrl), null);
- if(appo!=null && isNumeric(appo))
- stub.setTimeout((Integer.parseInt(appo))*1000);
- else
- stub.setTimeout(10000);
- out = stub.applicationManagement(dnis);
- }
- catch (MalformedURLException me )
- {
- System.out.println("Errore URL= " + wsUrl );
- System.out.println("Errore in Wrapper.getIVRService() MalformedURLException ! " + me.getMessage() );
- // e.printStackTrace();
- }
- catch (RemoteException re )
- {
- System.out.println("URL= " + wsUrl );
- System.out.println("Errore in Wrapper.getIVRService() RemoteException! " + re.getMessage() );
- // e.printStackTrace();
- }
- catch (Exception e )
- {
- System.out.println("Errore in Wrapper.getIVRService()! " + e.getMessage() );
- // e.printStackTrace();
- }
- return out;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement