Hi all:

 

I have the problem when I try to test the Webservice using C# using the Axapta COM Connector

I get a exception when I try to logon to Axpata…. However I won’t have such error when I write a Windows Application using C#

Any one know what is happening to my code?

 

Regards,

Joel

 

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using System.Data.SqlClient;

namespace AxaptaConnector

{

     /// <summary>

     /// Summary description for Service1.

     /// </summary>

     public class AxaptaService : System.Web.Services.WebService

     {

           public AxaptaService()

           {

                //CODEGEN: This call is required by the ASP.NET Web Services Designer

                InitializeComponent();         

           }

 

           #region Component Designer generated code

          

           //Required by the Web Services Designer

           private IContainer components = null;

                    

           private void InitializeComponent()

           {

           }

           protected override void Dispose( bool disposing )

           {

                if(disposing && components != null)

                {

                     components.Dispose();

                }

                base.Dispose(disposing);       

           }

          

           #endregion

 

           [WebMethod]

           public string getCustCount()

           {   

                int cnt;

                AxaptaCOMConnector.Axapta2 Axapta = new AxaptaCOMConnector.Axapta2Class();

 

                DataSet mydataset = new DataSet();

                try

                {

                     Axapta.Logon2("Admin","adminpwd","tx2","","","",",",",");

                }

                catch(Exception Er)

                {

                     return Er.Message;        ß----------------------------------------------- Exception Happen

                }

 

                AxaptaCOMConnector.IAxaptaRecord CustRecord;

                try

                {

                     CustRecord = Axapta.CreateRecord("CustTable");

                     cnt = 0;

                     while (CustRecord.Found)

                     {

                           cnt++;

                           CustRecord.Next();

                     }

                }

                catch(Exception Err)

                {

                     Axapta.Logoff();

                     return Err.Message;

                }

                Axapta.Logoff();

                return "OK";

           }

     }

}

 



Sharing the knowledge on Axapta.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to