Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with simple Acumatica contract soap api call

Tags:

soap

acumatica

I'm trying to get a simple Acumatica contract-based SOAP API Get() or GetList() call to work and all I'm getting is an error:

System.ServiceModel.FaultException: 'System.ArgumentNullException: Value cannot be null. Parameter name: model

See the code below. I first tried the REST API, but couldn't get around different issues (which I'll also probably add in another post). Any ideas what the error is referring to?

using (var soapClient = new ServiceReference1.DefaultSoapClient())
{
    //Log in to Acumatica ERP
    soapClient.Login
    (
        "admin",
        "admin",
        "Company",
        null,
        null
    );

    ServiceReference1.SalesOrder orderToFind = new 
        ServiceReference1.SalesOrder
        {
            CustomerID = new ServiceReference1.StringValue { Value = "2" },
            OrderType = new ServiceReference1.StringValue { Value = "SO" },
            OrderNbr = new ServiceReference1.StringValue { Value = 
                "SO001337" },
        };

        var getOrder = soapClient.Get(orderToFind);

        var getOrders =
            soapClient.GetList(orderToFind);
}

Acumatica v17.204.0019.

like image 290
Tony Lanzer Avatar asked Jun 26 '26 09:06

Tony Lanzer


1 Answers

Just encountered the same error and a little ashamed to admit that solution appeared to be super simply for me: the binding was simply missing allowCookies="true" in app.config

Having enabled cookies, error ArgumentNullException: Value cannot be null. Parameter name: model got resolved:

<binding name="DefaultSoap" allowCookies="true" />
like image 68
RuslanDev Avatar answered Jul 01 '26 06:07

RuslanDev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!