How to Handle Error responses from External appliaction when we use with COM Interface

Discussion in 'Tally Developer' started by maheshg, Nov 12, 2013.

    
  1. maheshg

    maheshg New Member


    Hi,

    We use COM interface to interact with external application, some times the application may down(not running) or we may pass wrong values(parameters) to COM Interface. At those times COM Interface give the response back with error.

    The error responses are something like below:

    FUNCTION: 'GetTicket' LABEL: 06 : Call to COM Interface was made but an error occurred. This can be because of wrong no. of parameters or wrong types of parameters.
    FUNCTION: 'GetTicket' LABEL: 06 : Action execution failed!
    FUNCTION: 'GetTicket' LABEL: : Action execution failed!


    How to handle those type of errors in tally using TDL.

    Regards
    MaheshG
     


  2. Manthan

    Manthan New Member


    bump !

    Getting Same error while calling the com interface.
    Have anyone found any solution for the same?
    This error varies from machine to machine, in some machine code works properly & in some it doesn't and give the same error as mentioned above, while the isdllinvokable function returns true/yes.

    Waiting for a solutions
    Regards,
    Manthan Patel
     


  3. Vaidehi Joshi

    Vaidehi Joshi New Member


    I am also getting the same error any solution?
     


  4. kosi

    kosi Member


    In this forum I have realized that if u want your problem to be resolved, u have to post source codes with the actual problem well explained.
    If u really need answers follow my principle.
     


  5. Vaidehi Joshi

    Vaidehi Joshi New Member


    Thanks,Called to com interface was made but an error was happened wrong number of parameters or wrong type of parameteres.
    Com interface :
    I/P parameter:String
    O/P parameter:Int
    Please kindly help

    I am getting an error ,
    //c# code dll file
    using ServiceStack;

    namespace Trial_Project
    {
    public class Class1 : IDll
    {

    public int pro(string ledgerName)
    {

    int assetbalance = GetCustomerAssetBalance("TST001");
    return assetbalance;
    }
    public int GetCustomerAssetBalance(string CustMID)
    {

    string ApiKey = //Assigned value;
    string BaseUrl = //Assigned value
    const string UserAgent = //Assigned value
    var client = new JsonServiceClient(BaseUrl);
    client.UserAgent = UserAgent;
    client.Headers["X-Api-Key"] = ApiKey;


    // This configures the Authorization HTTP header
    client.SetCredentials("email id", "password");
    // This sends a GET /api/asset balanceByCustomer request
    AssetBalancesByCustomer objectassetbalance = new AssetBalancesByCustomer();
    objectassetbalance.CustomerMId = CustMID;
    AssetBalances objLocationsQueryResult = client.Get(objectassetbalance);

    // This sends a GET /api/fills/new request to retrieve fill records

    return objLocationsQueryResult.Rows[0].AssetTypes[0].QuantityBalance;
    }
    [ComImport, Guid("fbcd00a1-0de9-4763-9ffa-b1e5e5cfb827"), InterfaceType

    (ComInterfaceType.InterfaceIsIUnknown)]
    internal interface IDll
    {
    int pro(String num);
    }

    ;;Tdl File code

    [COM Interface:pushdata]

    Project: Trial_Project
    Class: Class1
    Interface:pro
    Parameters: p3 : String : In
    Return:Number

    [#Line:fielddll]

    Option : On Focus fldVCHPassToTA: @@IsSalesOrder

    [!Line: On Focus fldVCHPassToTA]

    Add : Right Fields : At Beginning : Medium Prompt, dllfield
    Local : Field : Medium Prompt :Info : "Asset Balance :"

    [Field: dllfield]

    Use : Name Field
    On:Focus:Yes:Call:pushdata1:#EIConsignee
    [System: UDF]
    dllfield : String: 999
    [Function:pushdata1]

    PARAMETER : Header : STRING


    Variable :fielddllloc:NUMBER
    01: If: $$IsCOMInterfaceInvokable:pushdata
    02:Exec COM Interface :pushdata:##Header
    03:Log:$$LastResult
    04:Set:fielddllloc:($$LastResult)
    05:Set Value:fielddll:(##fielddllloc)
    Else
    06 : Msg Box:"Info":"COM Interface is not invokable or\n DLL is not registered"
     


  6. Devendra_Rawat

    Devendra_Rawat Well-Known Member




  7. There are 2 ways the issue can be solved
    A) Identify the COM is proper which in the Sample of Tally there is proper or not and can be executed or not
    B) from the DLL you can do the ERROR handling and give proper return

    From the above you have already given the $$IsCOMInterfaceInvokable then 1st issue should get resovled if the com is not proper
    2nd you can do the Error Handling
     


  8. Vaidehi Joshi

    Vaidehi Joshi New Member


    Thanks ,
    After adding $$IsCOMInterfaceInvokable error is changed to,
    FUNCTION:'pushdata1'LABEL:ELSE:Unknown action'(null)'!

    I have written a dummy code in which simply adding two numbers and returning to tally,Then it is working,Giving an error while calling api method.
     


  9. Vaidehi Joshi

    Vaidehi Joshi New Member


    Option B) work in this case,Getting error lines,
    at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
    at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) ...
    And get handled by adding "SecurityProtocolType.Tls12".
    Thank you Sir for guiding.Thanks a lot.
     


Share This Page