Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Calling Ilog from web service

    Posted Thu August 12, 2010 12:11 PM

    Originally posted by: BKRORC


    Hello ,
    I developed a web service that use ILOG.
    I run web service in Visual studio
    and
    I call the web service from a client.
    Everyting is ok

    but

    I deploy web service on IIS on local machine
    when I call the web service from client I get this error. what is the problem?

    System.TypeInitializationException: The type initializer for 'ILOG.OPL.OplFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'ILOG.OPL.opl_lang_wrap' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGIloExceptionHelper' threw an exception. ---> System.TypeInitializationException: The type initializer for 'ILOG.OPL.opl_lang_wrapPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'opl122_dotnet': Belirtilen modül bulunamadı. (Exception from HRESULT: 0x8007007E)
    at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_opl_lang_wrap(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
    at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGExceptionHelper..cctor()
    --- End of inner exception stack trace ---
    at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGExceptionHelper..ctor()
    at ILOG.OPL.opl_lang_wrapPINVOKE..cctor()
    --- End of inner exception stack trace ---
    at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGRegisterIloExceptionCallbacks_opl_lang_wrap(SWIGIloExceptionDelegate iloExceptionDelegate, SWIGIloExceptionDelegate iloOplExceptionDelegate)
    at ILOG.OPL.opl_lang_wrap.SWIGIloExceptionHelper..cctor()
    --- End of inner exception stack trace ---
    at ILOG.OPL.opl_lang_wrap.SWIGIloExceptionHelper..ctor()
    at ILOG.OPL.opl_lang_wrap..cctor()
    --- End of inner exception stack trace ---
    at ILOG.OPL.opl_lang_wrap.touch()
    at ILOG.OPL.OplFactory..cctor()
    --- End of inner exception stack trace ---
    at ILOG.OPL.OplFactory..ctor()
    at WebSrvcBedenAnalizi.CSServiceBedenAnalizi.NRunILog(Int32 Id) in C:\ILOG\WebService\Service\WebSrvcBedenAnalizi\WebSrvcBedenAnalizi\ServiceBedenAnalizi.asmx.cs:line 39
    at WebSrvcBedenAnalizi.CSServiceBedenAnalizi.Coz(Int32 Deger) in C:\ILOG\WebService\Service\WebSrvcBedenAnalizi\WebSrvcBedenAnalizi\ServiceBedenAnalizi.asmx.cs:line 31
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Calling Ilog from web service

    Posted Fri August 13, 2010 04:57 AM

    Originally posted by: BKRORC


    I copied all dll to bin dir.
    I dont get this error now.

    but now
    program not run on this command opl.Generate();
    I did not get error but do nothing .
    Program Wait opl.Generate();

    is there a problem IIS users?
    or
    is there a ILOG settings problem for web service?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Calling Ilog from web service

    Posted Mon August 16, 2010 06:38 PM

    Originally posted by: SystemAdmin


    For calling OPL from your web service program all you should need is adding oplall.dll (present in opl-install-dir\lib folder) as reference to your web service project and making sure that PATH environment variable has path to opl-install-dir\bin\x86_win32 folder (assuming win 32 installation).

    You might want to try solving an OPL model that comes with standard distribution to verify if your latest issue of hanging on opl.Generate() is specific to your model or, it has something to with environment.

    If it is specific to your model then I would suggest debugging the model-data instance through OPL IDE. If data for model is populated through a custom data source then you could put a break-point in the data source code and step through to see if the issue is in your data source.

    To isolate if the issue is specific to IIS; you might want to check if the web service call works fine when running with the development ASP server that comes with visual studio.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Calling Ilog from web service

    Posted Tue August 17, 2010 07:39 AM

    Originally posted by: BKRORC


    Hello,
    here is my PATH environment
    C:\ILOG\CPLEX_Studio_Preview122\opl\bin\x86_win32;
    C:\ILOG\CPLEX_Studio_Preview122\opl\oplide\;
    C:\ILOG\CPLEX_Studio_Preview122\cplex\bin\x86_win32;
    C:\ILOG\CPLEX_Studio_Preview122\cpoptimizer\bin\x86_win32;

    I devoleped very simple model on ILOG.
    I fetch data from a database.

    I run web service in VS2008 then I call the web service from another application
    ILOG model was solved , everthing is ok.

    But I published web service to IIS then I copied all dll(opall.dll , opl122_dotnet.dll ...) to C:\Inetpub\wwwroot\ILOG\bin

    then I call web service from the client I got this error "Processing failed"

    here is program stack

    at ILOG.OPL.opl_lang_wrap.SWIGIloExceptionHelper.ThrowIloException(String message)
    at ILOG.OPL.opl_lang_wrapPINVOKE.OplModel_getOuterModel(IntPtr jarg1)
    at ILOG.OPL.OplModel.getOuterModel()
    at ILOG.OPL.OplModel.generate()
    at ILOG.OPL.OplModel.Generate()
    at WebSrvcBedenAnalizi.CSServiceBedenAnalizi.NRunILog(Int32 Id) in C:\ILOG\WebService\Service\WebSrvcBedenAnalizi\WebSrvcBedenAnalizi\ServiceBedenAnalizi.asmx.cs:line 100

    thank you, for your helping
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Calling Ilog from web service

    Posted Tue August 17, 2010 03:38 PM

    Originally posted by: SystemAdmin


    Perhaps the issue is establishing DB connection when model is running in IIS. Are you using OPL .dat file for connecting to DB? which DB are you using? Could you try using odbc connection from your OPL .dat file (assuming you are not already doing that)?

    To verify that it is an issue of connecting to DB you could run your model with a .dat file that has exported data (rather than fetching data from DB). You could create such a .dat file from your C# code when you run in Visual Studio using OplModel.PrintExternalData() API.

    To check if the DB is accessible from IIS, you might try just opening and closing connection to that DB from your C# code and see if that works.

    An alternative to using .dat file for DB connections would be to get data from DB through C# code and then populate OPL model using OPL C# API. If you want to use connection pool for DB connections then that would be the configuration you would have to use anyway.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Calling Ilog from web service

    Posted Wed August 18, 2010 03:09 AM

    Originally posted by: BKRORC


    Hello,
    I checked my sample with an external data on IIS and succesfull genarate my model
    but
    when I tried tu use db connection I got the error message again.

    We use Sqlserver.

    Here is my .dat file context

    /*********************************************
    * OPL 12.2 Data
    * Author:
    * Creation Date: Jul 19, 2010 at 4:44:15 AM
    *********************************************/
    /*********************************************
    * OPL 6.3 Data
    * Author:
    * Creation Date: Jun 4, 2010 at 5:38:51 AM
    *********************************************/
    PID = 3;
    Deger=" de";

    DBConnection db("oledb","SERKAN/SRK/tempdata/temaoltp");

    Veri from DBRead(db,"select rtrim(cast (optionref as char(20))),rtrim(cast (urunref as char(10))),sablon_AnalitikSatis,MinKoliIci,MinSiparisMiktari,MaxSiparisMiktari FROM Tempdata..BA_parametre_urun where optionref in (select top 5 optionref from Tempdata..BA_parametre_option where optionref not in (select optionref from Tempdata..BA_TamamlananOptionlar) order by optionref)");

    Option to DBUpdate(db,"INSERT INTO Tempdata..BA_TamamlananOptionlar (optionref) VALUES(?)");
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Calling Ilog from web service

    Posted Wed August 18, 2010 12:26 PM

    Originally posted by: SystemAdmin


    It could be a security issue with talking to SQL Server from IIS. Here is a link that I found with a quick web search that could be related:
    http://support.microsoft.com/kb/815154

    Basically, your application is trying to use OLEDB to connect to SQL Server from IIS and you need to find what specific configurations are to be done on IIS/SQL Server side to get it working.

    It is more of an IIS/SQL Server question. The DBLink product that OPL uses to connect to SQL Server using OLEDB is not doing any special configuration that is specific to web servers like IIS or, for that matter any other web server.

    As I had mentioned before, you might first try using a direct connection from your web service code (using ADO/OLEDB/ODBC) and get that working.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer