Loading

Call a NetSuite Web Service through SoapUI

Publiceringsdatum: Jul 28, 2025
Steg

DESCRIPTION

This article explains How to call a NetSuite Web Service through SoapUI. This would help to validate the response that is generated in MuleSoft's NetSuite connector.

STEPS TO FOLLOW

Step 1:  Need to generate a nonce, timestamp, and valid Signature which are unique for each request. These can be generated using the below PHP code example. Here is the document provided by NetSuite on the same. Below is the complete PHP code that would generate nonce, timestamp, and signature respectively each in a new line). Replace the values url, tokenKey, tokenSecret, consumerKey, consumerSecret, and realm with your NetSuite authentication values. Save the code in a .php file.

<html>
<head>
<title></title>
</head>
<body>
<?php
$url = 'https://<your_netsuite_suitetalk_api_url>/services/NetSuitePort_2021_1';
//or https://123456.suitetalk.api.netsuite.com/services/NetSuitePort_2015_2 for webservices
//or https://123456.suitetalk.api.netsuite.com/services/rest/record/v1/employee/40 for REST web services
$httpMethod = 'POST'; //or $httpMethod = 'GET'; for REST Web Services
$tokenKey = '';
$tokenSecret = '';
$consumerKey = '';
$consumerSecret = '';
$signatureMethod = 'HMAC-SHA256';     //or HMAC-SHA1
$nonce = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
echo $nonce;
echo "<br>";
$timestamp = time();
echo $timestamp;
echo "<br>";
$version = '1.0';
$realm = '';                   //scompid or accountid
$baseString = rawurlencode($realm) ."&". rawurlencode($consumerKey) ."&". rawurlencode($tokenKey) ."&". rawurlencode($nonce) ."&". rawurlencode($timestamp); 
$key = rawurlencode($consumerSecret) .'&'. rawurlencode($tokenSecret); 
$signature = base64_encode(hash_hmac('sha256', $baseString, $key, true));    //or sha1 
            
echo $signature;
?>
</body>
</html>

Step 2: Run the above PHP code to generate the values. For example, This is one of the ways to run the PHP code.

  • Install PHP on the machine.
  • Go to the directory (cd to that directory) where the .php file is available.
  • And then run "php -S localhost:8080"
  • Finally, open any browser and type the URL http://localhost:8080/<your .php file>
  • The nonce, timestamp, and signature values are generated respectively in the new line.

Step 3: Create a new soap project in SoapUI with the NetSuite account wsdl for example: https://<netsuite_suitetalk_api_url>/wsdl/v2021_1_0/netsuite.wsdl
Below screenshot on where to find the NetSuite SUITETALK (SOAP AND REST WEB SERVICES) url. On NetSuite account-> Setup -> Company -> Company Information -> Company URLs.

User-added image
Step 4: The below example request is for savedSearch operation. Change based on your operation and replace the token passport authentication values with your NetSuite account authentication values. Provide nonce, timestamp, and signature values that are generated in the above Step 1. Send the request through SoapUI to see the response.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <tokenPassport xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
            <account xmlns="urn:core_2021_1.platform.webservices.netsuite.com">accountid</account>
            <consumerKey xmlns="urn:core_2021_1.platform.webservices.netsuite.com">consumerkey</consumerKey>
            <token xmlns="urn:core_2021_1.platform.webservices.netsuite.com">tokenid</token>
            <nonce xmlns="urn:core_2021_1.platform.webservices.netsuite.com">generatednoncefromphpcode</nonce>
            <timestamp xmlns="urn:core_2021_1.platform.webservices.netsuite.com">generatedtimestampfromphpcode</timestamp>
            <signature xmlns="urn:core_2021_1.platform.webservices.netsuite.com" algorithm="HMAC_SHA256">generatedsignaturefromphpcode</signature>
        </tokenPassport>
        <searchPreferences xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
            <bodyFieldsOnly>true</bodyFieldsOnly>
            <returnSearchColumns>true</returnSearchColumns>
            <pageSize>10</pageSize>
        </searchPreferences>
        <preferences xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
            <warningAsError>false</warningAsError>
            <disableMandatoryCustomFieldValidation>false</disableMandatoryCustomFieldValidation>
            <disableSystemNotesForCustomFields>false</disableSystemNotesForCustomFields>
            <ignoreReadOnlyFields>true</ignoreReadOnlyFields>
            <runServerSuiteScriptAndTriggerWorkflows>true</runServerSuiteScriptAndTriggerWorkflows>
        </preferences>
    </soap:Header>
    <soap:Body>
        <ns0:search xmlns:ns0="urn:messages_2021_1.platform.webservices.netsuite.com">
            <ns0:searchRecord xmlns:ns01="urn:sales_2021_1.transactions.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns01:TransactionSearchAdvanced" savedSearchId="683"/>
        </ns0:search>
    </soap:Body>
</soap:Envelope>
 

 

Knowledge-artikelnummer

001115587

 
Laddar
Salesforce Help | Article