Search code examples
netsuitesoapexceptionsoaphttpclientprotocol

SoapHttpClientProtocol automatically retry after exception?


I am just curious about this. I am making a change in this project, that is using NetSuite web service, and sometimes it throws a SoapException at random, "Only one request may be made against a session at a time".

    private NetSuiteService _service;

    SessionResponse response = _service.login(passport); //if SoapException, retries??
    Status status = response.status;

Reference.cs:
    public partial class NetSuiteService : 
System.Web.Services.Protocols.SoapHttpClientProtocol

My question is: If I am in debug mode, I trace this, and I hit F5, and it seems to automatically retry after exception is thrown (the code keeps running, with no try catch block implemented, no while loop) until successful (status.isSuccess == true). When I run it in release mode, as a windows service, the log shows it stops running after exception is thrown.

How is this possible? Is it better to catch this exception in a try catch block and retry?


Solution

  • NS Server refuses a request if its already processing one from the same user.

    If you want to make sure that your request succeeds than you have to catch this exception and retry.