Building an Application with Microsoft .NET

This section provides details on how to use the Microsoft .NET platform to build a SOAP web services application. You can also see Downloading Sample Applications for a .NET sample currently available.


When building an application with Microsoft .NET, you should use Visual Studio .NET since it provides an integrated development environment to build and debug your Web service applications. Alternatively, you can download and install the Microsoft .NET Framework SDK. However, this only provides you with the SDK and does NOT provide an integrated IDE.

All code samples in this section use the C# language, however these steps are similar for all other languages supported by Microsoft .NET. These languages include Visual Basic, Visual J#, and C++.

To use Microsoft .NET with NetSuite SOAP web services:

  1. Install the Microsoft .NET framework.

    Install Microsoft .NET Framework 4.6, which includes the .NET framework SDK (PREFERRED), or the Microsoft .NET Framework SDK version 1.1 (NOT preferred).

  2. Use the .NET framework SDK to automatically generate the client proxy code

    If using Microsoft .NET Framework (PREFERRED):

    1. Start Microsoft .NET Framework 4.6.

    2. Create a new project and choose a template, for example, Console Application.

    3. After the project has been created, add a Web reference.

      The Add Web Reference option may be available in the Project menu. If not, select Add Service Reference, click the Advanced button, and click the Add Web Reference button.

    4. In the Add Web Reference dialog, enter the SOAP WSDL URL and click the Go icon.

      A URL for the latest SOAP WSDL is:


      Although the material in this guide pertains to the latest NetSuite WSDL, we continue to support endpoints released prior to this version.

    5. Visual Studio inspects the WSDL and displays a summary of the available operations. If security warnings are displayed, click Yes as many times as necessary to continue this process.

    6. After the summary is displayed, click the Add Reference button to generate the classes.

      When this process is complete, com.netsuite.webservices is listed under Web References in the Solution Explorer.

    7. To view all generated proxy classes, do one of the following:

      • Enable the Show All Files option in the Project menu

      • (If the above option is not available), right-click the com.netsuite.webservices listing in the Solution Explorer and choose View in Object Browser.

    If using only the Microsoft .NET Framework SDK (NOT preferred):

    1. Locate the wsdl.exe file under the Microsoft .NET Framework SDK installation and add it to your system path.

    2. Open a command prompt, and type the following to generate the proxy classes:

                                      wsdl /language:<language> <url> 

      Where <language> is your preferred language and <url> is the URL for the NetSuite WSDL.

      For example, generate the proxy classes in C# as follows:

                                      C:\project>wsdl /language:cs

      A C# file called NetSuiteService.cs is generated.

    3. Compile the source code for your proxy into a .NET Assembly using the .NET Framework C# compiler or any other supported compiler.

    4. Locate the csc.exe file under the Microsoft .NET Framework SDK installation and add it to your system path.

                                csc.exe /out: NetSuiteService.dll /target:library 
                reference:system.xml.serialization.dll /
  3. Implement your application by writing your business logic using the generated .NET proxy classes.

    Note that the following code snippets are shown in C#.

    1. Allow the use of objects from the newly created namespace without having to qualify them.

                                      using <namespace>.com.netsuite.webservices; 
    2. Instantiate the NetSuite service.

                                      NetSuiteService service = new NetSuiteService(); 
    3. Enable support for multiple cookie management.

                                      service.CookieContainer = new CookieContainer(); 
    4. Create a valid session by populating the Passport object.

                                      //invoke the login operation
                  Passport passport = new Passport();
                  passport.account = "TSTDRV96";
         = "";
                  RecordRef role = new RecordRef();
                  role.internalId = "3";
                  passport.role = role;
                  passport.password = "<SOAP web services password>";
                  Status status = service.login( passport ).status; 
    5. Implement your business logic. For example, create a new customer in NetSuite.

                                      Customer cust = new Customer();
                  cust.entityID( "XYZ Inc" );
                  WriteResponse response = service.add( cust ); 
    6. Logout to invalidate the current session.



Related Topics

SuiteTalk SOAP Web Services Platform Overview
SOAP Web Services Quick Start
SOAP Web Services Development Considerations
Enabling the SOAP Web Services Feature
Setting the Show Internal IDs Preference
Building an Application with Java using Apache Axis
Downloading Sample Applications
Capturing SOAP

General Notices