Skip to main content

I was following this training guide that I found on google.  Oddly enough I can’t find it via the actual website.

Anyways, I’ve gotten so close on getting my program to work in VS.  I was following the example in this file for exporting warehouses starting on page 11.

I keep getting this error.  I’ve tried everything I can think of.

System.Web.Services.Protocols.SoapException
  HResult=0x80131501
  Message=System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> PX.Data.PXException: API Login Limit
   at PX.LicensePolicy.PXLicensePolicy.CheckApiUsersLimits()
   at PX.Data.PXLogin.PX.Data.IPXLogin.LoginUser(String& userName, String password)
   at PX.Api.Services.LoginService.Login(String login, String password, String company, String branch, String locale, String prefix)
   at PX.Api.ContractBased.ILoginServiceExtensions.LoginForSoapApi(ILoginService loginService, IMultiFactorService multiFactorService, String login, String password, String company, String branch, String locale)
   at PX.Api.Soap.Screen.ScreenGate.Login(String name, String password)
   --- End of inner exception stack trace ---
  Source=System.Web.Services
  StackTrace:
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Objecto] parameters)
   at ConsoleApplication.apitest.Screen.Login(String name, String password) in C:\Users\icebird\source\repos\ConsoleApplication\Web References\apitest\Reference.cs:line 623
   at ConsoleApplication.Program.Main(Stringl] args) in C:\Users\icebird\source\repos\ConsoleApplication\Program.cs:line 18

  This exception was originally thrown at this call stack:
    rExternal Code]
    ConsoleApplication.Program.Main(stringC]) in Program.cs

 

Below is a snippet including the login line with the * in front.  Could someone help me see what I’m missing?

 

            apitest.Screen context = new apitest.Screen();
            context.CookieContainer = new System.Net.CookieContainer();
            context.AllowAutoRedirect = true;
            context.EnableDecompression = true;
            context.Timeout = 1000000;
            context.Url = "http://localhost/WebAPIVirtual/Soap/APITEST.asmx";
***            LoginResult result = context.Login("admin@Company:PRODWHOLE", "testtest");
            IN204000Content IN204000 = context.IN204000GetSchema();
            context.IN204000Clear();
            stringt]x] IN204000result = context.IN204000Export

Hi @icebird28  The issue is related to API Login Limit.

Hope you are working on your local instance, since there is no license applied on your instance, we have API limit like below screenshot. We can not make multiple request at a time and make sure that once you logged in to the instance you need to invoke the logout call as well at end.

 

As an alternative you can restart the IIS, so that session cache will be cleared and you can invoke the Webservice calls.

 

 


Thanks Naveen, the IIS reset worked and I’m getting no errors now.  Now I’m trying to access the following screen and cannot locate it in VS 2019.  Can you help?

 


Hi @icebird28  Hope below links can help you

https://asiablog.acumatica.com/2016/02/contract-based-web-services-api.html

https://openuni.acumatica.com/pdf/T210_Acumatica_Web_Services.pdf

 

Screen based API’s are going to obsolete, and going forward Acumatica supports only REST API’s. It will be better like you can work REST API instead of screen-based API’s.

REST API Link

https://asiablog.acumatica.com/2016/09/acumatica-rest-api.html


Thanks Naveen for the links.  In current versions what would you say the answer to this question is?

 

What object acts as a gateway between the web services client and Acumatica?

 

 


Hope this answers your question. @icebird28 

 


Is this still valid in the newer versions using SOAP and REST API?  I saw that in my document but wasn’t sure it was still accurate.


Hi @icebird28 

Can you please increase the Allowed numbers of session for the login user and try once.? 
 


Also check with the below sample code.
 

 class Program
    {
        static void Main(string ] args)
        {
            var soapClient = ConnectToAcumatica(
                    endpointUrl: "YourInstanceurl/entity/DefaultWithReadOnlyAttributes/18.200.001?wsdl",
                    login: "admin",
                    password: "",
                    company: "Company",
                    branch: null
            );

            try   { }
            catch (Exception ex) {
                string s = ex.Message.ToString();
            }
            finally {
                soapClient.Logout();
            }
        }

        public static DefaultSoapClient ConnectToAcumatica(string endpointUrl, string login, string password, string branch, string company = null)
        {
            var binding = new BasicHttpBinding
            {
                Name = "Acumatica",
                AllowCookies = true,
                MaxReceivedMessageSize = 216553600,
                CloseTimeout = new TimeSpan(0, 0, 20, 0),
                OpenTimeout = new TimeSpan(0, 0, 20, 0),
                ReceiveTimeout = new TimeSpan(0, 0, 20, 0),
                SendTimeout = new TimeSpan(0, 0, 20, 0),
                Security = { Mode = BasicHttpSecurityMode.Transport } //for HTTPS use BasicHttpSecurityMode.Transport
                                                                      // Security = { Mode = BasicHttpSecurityMode.None } //for HTTP  use BasicHttpSecurityMode.None
            };
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            var address = new EndpointAddress(endpointUrl);
            var soapClient = new DefaultSoapClient(binding, address);
            //Log in to Acumatica ERP
            soapClient.Login
            (
                login,
                password,
                company: company,
                branch: branch,
                locale: null
            );
            return soapClient;
        }
    }


Hi @icebird28  The issue is related to API Login Limit.

Hope you are working on your local instance, since there is no license applied on your instance, we have API limit like below screenshot. We can not make multiple request at a time and make sure that once you logged in to the instance you need to invoke the logout call as well at end.

 

As an alternative you can restart the IIS, so that session cache will be cleared and you can invoke the Webservice calls.

 

 

 

Just want to clarify on this, you can make multiple requests at once but only have two logged in user sessions. 0 in this case means unlimited. 


Reply