Application ID Code Samples (Request-Level Credentials)

The following procedure shows one way of updating an application to include an application ID, which is a field in the ApplicationInfo complex type. In the following C# code snippets, application ID is added to an integration’s request-level credentials.

For Java code samples, download the Java sample applications from the SuiteTalk Sample Applications site.

The ApplicationInfo complex type is defined in the Messages XSD.

To add an application ID to an integration:

  1. Create an ApplicationInfo class member. For example:

                    namespace NetSuite
    {
    
    class SOAPApplication
    {
    
          public NetSuiteService _service;            
          private Preferences _prefs;      
          private SearchPreferences _searchPreferences;
          private ApplicationInfo _appInfo; 
    
                  
  2. Create an instance of ApplicationInfo. Set the applicationId value to the application ID of the relevant integration record.

                    private void setApplicationInfo()
    {
    
          _appInfo = new ApplicationInfo();
          _service.applicationInfo = _appInfo;
          _appInfo.applicationId = "C4A2541D-16FB-4845-B8A2-8B8A34BDBB61";
    
    } 
    
                  
  3. Use your instance of ApplicationInfo to modify the SOAP header that will be generated.

                    public SuiteTalkCourse()
    {
       ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
    
       _service = new DataCenterAwareNetSuiteService();
       setPreferences();
       setPassport();
       setApplicationInfo();    
    
    } 
    
                  

    The next time the application sends a request, the application ID is included in the header.

                    <soap:Header>
       <applicationInfo xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
          <applicationId>A7EE88F2-9DAA-43A2-9940-29AAA0E2DA61</applicationId>
       </applicationInfo>
       <passport xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
          <email xmlns="urn:core_2017_1.platform.webservices.netsuite.com">user@wsuser.com</email>
          <password xmlns="urn:core_2017_1.platform.webservices.netsuite.com">**********</password>
          <account xmlns="urn:core_2017_1.platform.webservices.netsuite.com">1013519</account>
          <role internalId="3" xmlns="urn:core_2017_1.platform.webservices.netsuite.com"/>
       </passport>
       <preferences xmlns="urn:messages_2017_1.platform.webservices.netsuite.com"/>
    </soap:Header> 
    
                  

Related Topics

General Notices