Logging into multiple instances of Acumatica

Viewed 91

I have a development version of Acumatica running locally, and a QA version of Acumatica in the cloud.

I wrote c# program integrating with Acumatica through SOAP. I created WSDL file for Acumatica instance running locally at http://localhost/AcumaticaERP. Now I need to make the program to connect with Acumatica production instance in the cloud. soapClient.Login method does not have Acumatica URL as a parameter.

How do I allow users to dynamically chose an instance of Acumatica to use from within my program?

1 Answers

I would first suggest to look into the REST API since generally that's the recommended integration API to use.

Regarding dynamically changing the endpoint (i.e. Acumatica instance), note that the DefaultSoapClient has a number of overloaded constructors. There is one where you can specify the endpointConfigurationName (see below). This would mean that your URL should be in your web.config/appsettings of the client application as explained in more detail here: https://help-2020r1.acumatica.com/(W(1))/Help?ScreenId=ShowWiki&pageid=37613e5f-7a72-4dec-b5d9-2525951e99cf

public partial class DefaultSoapClient : System.ServiceModel.ClientBase<ConsoleApp2.ServiceReference1.DefaultSoap>, ConsoleApp2.ServiceReference1.DefaultSoap {

        public DefaultSoapClient() {
        }

        public DefaultSoapClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }

        public DefaultSoapClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }

        public DefaultSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }

        public DefaultSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }

In case using configuration files will not work for you, you can refer to this example whereby it is done programmatically: https://asiablog.acumatica.com/2019/01/dynamic-api-endpoint-url.html

Related