function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tf_ianrtf_ianr 

How to set Timeout when accessing the Salesforce Web Service/API

I am using C#/.NET to access the Salesforce API via the web service, after generating a WSDL file and integrating it into my Visual Studio project, etc.

 

I cannot find anywhere to set the Timeout for the calls to the Web Service - usually in .NET when you access a Web Service this is a property on the Proxy objects.

 

So .. how to I set the Timeout for the Salesforce API? 

Best Answer chosen by Admin (Salesforce Developers) 
WT007WT007

Try the binding object that you log in with. ie

'Returns a binding to Salesforce Session with the specified login


    Public Function Login(ByRef __SforceLogin As String, ByRef __SforcePassword As String)

        _SforceLogin = __SforceLogin
        _SforcePassword = __SforcePassword

        _myBinding = New partner.SforceService
        _lr = _myBinding.login(_SforceLogin, _SforcePassword)
        _myBinding.Timeout = 60000
        'on a successful login, you should always set up your session id
        'and the url for subsequent calls
        '
        'first create a session head object
        _myBinding.SessionHeaderValue = New partner.SessionHeader

        'set the sessionId property on the header object using
        'the value from the login result
        _myBinding.SessionHeaderValue.sessionId = _lr.sessionId

        'reset the url endpoint property, this will cause subsequent calls
        'to made to the serverURL from the login result
        _myBinding.Url = _lr.serverUrl

        Return _myBinding
    End Function