erikbays
erikbays

Reputation: 21

Netsuite Suitetalk service reference not working in ASP.NET and Visual Studio

I can't get Visual Studio (VS) to recognize the methods from the Netsuite sample code or other posts here. I'm attaching a screenshot (http://www.rpmex.com/img/Untitled-1.jpg) of my VS screen. The code is mostly from page 24 of the Netsuite documentation.

I have imported the WSDL in VS as a service reference. Was this wrong? I see a post (What is the difference between NetSuitePortType and NetSuiteService?) that says there is a distinction between a service reference and a web reference. The Netsuite documentation does say to import a web reference, but VS doesn't seem to have anything with that terminology.

VS is recognizing some methods like RecordRef, but it doesn't recognize calls to NetsuiteService or Passport, as you can see on the screenshot because those terms are underlined. Because there is a functioning namespace for the Netsuite Service Reference I assume I don't need to put a "using netsuiteServiceReference.com.netsuite.webservices; " line, but I did because the documentation says so.

My understanding is that VS should be recognizing any function call that is valid. Where am I going wrong?

In the following code I bolded (it is putting it bracketed in **) what VS has underlined as a syntax error

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using **netsuiteServiceReference.com**.netsuite.webservices;


namespace WebApplication5
{
    namespace netsuiteServiceReference
    {
        **NetSuiteService** service = new **NetSuiteService**();
        service.CookieContainer = new **CookieContainer**();
        //invoke the login operation
        Passport passport = new **Passport**();
        passport.account = "TSTDRV96";
        passport.email = "[email protected]";
        RecordRef record = new **RecordRef**();
        role.id = "3";
        passport.record = record;
        passport.password = "mypassword";
        Status status = service.login( passport ).status;
    }
    public partial class ThursdayTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

Upvotes: 2

Views: 2615

Answers (2)

Kevin Silha
Kevin Silha

Reputation: 81

Sounds like you created a Service Reference. You must create a Web Reference.

  1. Right click on project in solution explorer.
  2. Click Add > Service reference.
  3. On Service Reference screen, click Advanced button.
  4. On next screen, click Add Web Reference box.
  5. On next screen, enter NetSuite WSDL, e.g. https://webservices.netsuite.com/wsdl/v2014_1_0/netsuite.wsdl
  6. This will take a moment to load. Click through the warnings, and Add Reference.
  7. Now replace your includes, should look like using MySolution.com.netsuite.webservices;

Upvotes: 3

dangig
dangig

Reputation: 189

You may start from the SuiteTalk sample application that can be found here: http://www.netsuite.com/portal/developers/resources/suitetalk-sample-applications.shtml

This loads fine in Visual Studio.

Upvotes: 0

Related Questions