Building a Netsuite Application, returning 410 error

941 Views Asked by At

Background: I currently am a Netsuite Administrator (not a developer), with a background in PHP and MySQL programming and Wordpress Front End Design. I have worked with some of the Apache Freemarker in the Advanced HTML/PDF templates, and picked up the basics of C#, Java, etc in my free time. I currently work as a Graphic Designer/ Website Designer/Netsuite Administrator, with a long list of other IT related tasks. I have now been tasked with either figuring out how to build this application or find someone else to do it.

I am working on trying to build an application between Netsuite and servizi_xchange(ICON software).

I have been provided the WSDL information for both Netsuite and Servizi. From my understanding this is supposed to be an easy integration given the amount of information I have been provided. I have loaded both WSDL into Visual Studio 2019 and have began coding in C#.

I have Instantiated the NetSuite service, enabled cookie management, and created a valid session by populating the Passport object.

Unfortunately I now receive a System.Net.WebException: 'The request failed with HTTP status 410: Gone.'

using System.Threading.Tasks;
using Netsuite_Test.com.netsuite.webservices;

namespace Netsuite
{
    class Console
    {
        static void Main(string[] args)
        {
            // Create NetSuiteService instance 
            NetSuiteService _service = new NetSuiteService(); // Create CookieContainer for keeping session information 
            _service.CookieContainer = new System.Net.CookieContainer(); 
            // Create Passport 
            Passport passport = new Passport(); 
            passport.account = ""; //removed for privacy
            passport.email = ""; //removed for privacy
            passport.password = ""; //removed for privacy
            // Log in 
            SessionResponse response_login = _service.login(passport); 
            if (response_login.status.isSuccess) { 
                // Create an example reference to Customer ID 100 
                RecordRef recref = new RecordRef(); 
                recref.type = RecordType.customer; 
                recref.typeSpecified = true; 
                recref.internalId = "100"; // Fetch Customer record 
                ReadResponse response_get = _service.get(recref); 
                // Log out 
                _service.logout(); }else { 
                // Authentication failed 
            }
        }
    }
}

The company that is supposed to be helping implement the software has informed me they have never integrated with Netsuite, and have now told me I am on my own to figure it out.

I could use as much help as possible, with any resources anyone can provide being helpful as to how to get started.

I have read through Netsuite documentation in regards to SOAP Web services and tried to download the SOAP .Net examples, and have no idea how to open them (it is an .msi file that simply installs and does nothing to help me).

1

There are 1 best solutions below

0
On

It's likely you need to set the URL for the service to be your account specific URL. Here's an example that uses passport credentials on each login rather than using the login method:

var ns = new NetSuiteService()
{
    Url = "https://<ACCOUNTID>.suitetalk.api.netsuite.com/services/NetSuitePort_2019_2",
    passport = new Passport()
    {
        account = "<ACCOUNTID>",
        email = "<EMAIL>",
        password = "<PASSWORD>",
        role = new RecordRef() {internalId = "3"},
    },
    applicationInfo = new ApplicationInfo() {applicationId = "<APPLICATIONID>"},
};

var customerRef = new RecordRef()
{
    type = RecordType.customer,
    typeSpecified = true,
    internalId = "100"
};

var response = ns.get(customerRef);
if (response.status.isSuccess)
{
    var customer = response.record as Customer;
    Console.WriteLine(customer.companyName);
}

The APPLICATIONID can be set up in NetSuite at Setup > Integration > Manage Integrations > New