Error while executing web part: System.Net.WebException: The operation has timed out

Symptoms: You have custom  data form web parts in SharePoint page connected via several types of data sources. While opening the page the web parts fail to render with below error.

Unable to display this Web Part. For information on how to solve the problem, open this web page in an HTML editor compatible with Microsoft SharePoint Foundation, such as Microsoft SharePoint Designer. If the problem persists, contact the web server administrator.
Correlation Identifier: 6e922b9e-26ce-e067-e53b-397abcad5020

If you collect the ULS logs, you can see below error.

11/10/2017 11:51:38.06        w3wp.exe (0x402C)        0x1438        SharePoint Foundation        Web Parts        89a1        High
Error while executing web part: System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.SharePoint.WebControls.SoapDataSource.GetResponseString(SoapCommand currentSoapCommand)
at Microsoft.SharePoint.WebControls.SoapDataSource.ExecuteInternal(SoapCommand currentSoapCommand)
at Microsoft.SharePoint.WebControls.BaseXmlDataSource.Execute(String request)
at Microsoft.SharePoint.WebControls.BaseXmlDataSource.GetXmlDocument()
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetHierarchicalXPathNavigator(IHierarchicalDataSource ds)
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)        ae932b9e-163d-e067-d10d-36ae21cd099e

11/10/2017 11:51:38.06        w3wp.exe (0x402C)        0x1438        SharePoint Foundation        Monitoring        b4ly        High        Leaving Monitored Scope (DataBinding DataFormWebPart (Data)). Execution Time=30008.3137661351        ae932b9e-163d-e067-d10d-36ae21cd099e

Cause: This happens because of the default "Data-retrieval-services-timeout" timeout of 30 seconds. The data source takes more than 30 seconds to respond back which result in the error.

Solution: You can increase the default "Data-retrieval-services-timeout" timeout to a greater value like 45 seconds.

stsadm -o setproperty -pn data-retrieval-services-timeout -pv 45

Refer: https://technet.microsoft.com/en-us/library/cc288342%28v=office.12%29.aspx

This setting applies to the following data retrieval services:
OLDEB
SOAP Passthrough
XML-URL
SoapDataSource
XmlUrlDataSource