After successfully following the steps detailed in the following articles related to SOAP Web Services Integration:
You are now ready to interact with records within NetSuite. One of the key operations available in SOAP Web Services is the getServerTime operation. This operation returns the NetSuite server time in GMT. This functionality is crucial for ensuring synchronization in your applications since relying on client-side time can introduce inaccuracies, especially if the client's local time is not synchronized with the NetSuite server.
Key Benefits:
- Server Synchronization: Ensures accurate timestamps for synchronization procedures.
- Universal Applicability: GMT is a universal standard, making it easy to adjust for different time zones as needed.
Handling Time Zones
If desired, developers can convert the GMT server time to their local time zone using client-side code. The time returned by getServerTime follows a specific format, which includes:
- Date: YYYY-MM-DD (e.g., 2005-09-21).
- Time: HH:MM:SS.sss (e.g., 15:24:00.000).
- Time Zone Offset: ±HH:MM (e.g., -07:00).
For example, the response 2005-09-21T15:24:00.000-07:00 represents a timestamp of September 21, 2005, at 3:24 PM with a time zone offset of UTC-7.
Note: Any NetSuite user with an active session can call the getServerTime operation. This functionality does not require additional permissions, making it accessible to all authenticated users.
SOAP Request
To retrieve the server time, your SOAP request should look like this:
<soapenv:Body>
<getServerTime xsi:type="platformMsgs:GetServerTimeRequest"/>
</soapenv:Body>
Here's a breakdown of the key components of the SOAP body:
1. <soapenv:Body>
- This is a standard SOAP element that encloses the specific operation being requested.
- All SOAP requests must have a <Body> element where the details of the request reside.
2. <getServerTime>
- This is the name of the operation you are calling within the NetSuite SOAP API.
- It instructs the NetSuite server to execute the getServerTime operation, which retrieves the current server time.
3. xsi:type="platformMsgs:GetServerTimeRequest"
- xsi:type: Specifies the data type or schema type of the operation being executed.
- platformMsgs:GetServerTimeRequest: Indicates that this request is part of the platformMsgs namespace, which organizes SOAP messages related to NetSuite's platform operations.
SOAP Response
A successful response will include the server time in the specified format. Below is an example:
<soapenv:Body>
<getServerTimeResponse xmlns="">
<platformCore:getServerTimeResult xmlns:platformCore="urn:core_2021_1.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true"/>
<platformCore:serverTime>2024-12-02T21:42:32.000-08:00</platformCore:serverTime>
</platformCore:getServerTimeResult>
</getServerTimeResponse>
</soapenv:Body>
Here's a breakdown of the key components of the SOAP body:
1.<getServerTimeResponse xmlns="">
- Represents the operation's response (getServerTimeResponse).
- The xmlns="" attribute indicates the absence of a specific namespace for this element, relying on the global context.
2.<platformCore:getServerTimeResult>
- Represents the main result of the getServerTime operation.
3.<platformCore:status isSuccess="true"/>
- status: Indicates whether the operation was successful.
- isSuccess="true": Confirms the request was executed without errors.
4.<platformCore:serverTime>
- Contains the server time value returned by NetSuite.
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect, or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
You can check different New to NetSuite Articles about different operations, See the following.
Stay tuned for upcoming articles where we explore SOAP Web Services under SuiteCloud Product Area. Stay updated by following the New to NetSuite> SuiteCloud category to receive notifications whenever new articles are published.