Last post Sep 03, 2018 07:42 AM by PatriceSc
Aug 31, 2018 07:49 PM|esr124|LINK
I'm consuming web services from a 3rd party vendor. I currently have my code where I create the connection to the web service and then make all the necessary calls on that single connection.
I was recently told that it was better to create a connection for each individual call.
Can someone tell what the best practice is regarding multiple web service calls? Single connection for all calls or a connection for each and every call?
Aug 31, 2018 08:15 PM|mgebhard|LINK
A persistent connection is part of the HTTP spec. Best practice is driven by the 3rd party service specs. See the service support docs.
Aug 31, 2018 08:42 PM|DA924|LINK
Why would a single connection with everything being done in one shot be an issue? I kind of doubt that. If doing a multiple connection solution, it would seem to add additional overhead of cycling through the logic.
Aug 31, 2018 08:45 PM|esr124|LINK
That was my thought also.
Aug 31, 2018 08:47 PM|esr124|LINK
The 3rd party vendor is less than stellar when it comes to documentation and providing support.
We were actually told to not use some of their web service calls if we knew they would return large number of records.
Aug 31, 2018 10:13 PM|bruce (sqlwork.com)|LINK
Sep 03, 2018 07:42 AM|PatriceSc|LINK
If a service returns a large number of records you can usually use "paging'". Could it be what they tried to tell ?
Else technically speaking the best practice for HttpClient is reusing it: https://blogs.msdn.microsoft.com/shacorn/2016/10/21/best-practices-for-using-httpclient-on-services/