Hi Friends ,
I am facing error "Error QBWC1042: ReceiveResponseXML failed – Error message: The operation has timed out",
Once i tried to run web service(ASMX service) with web connector for Quickbook throwing that error.
According my requirment i am posting Invoice of some client in Quickbook ,
No of Client :-300 and each client have 100+ invoice .
=>I've created request for each client and invoices in service and response
Request code:-
- [WebMethod(Description = "This web method facilitates web service to send request XML to QuickBooks via QBWebConnector", EnableSession = true)]
-
- public string sendRequestXML(string ticket, string strHCPResponse, string strCompanyFileName,
- string qbXMLCountry, int qbXMLMajorVers, int qbXMLMinorVers)
- {
-
-
- if (Session["counter"] == null)
- {
- Session["counter"] = 0;
- }
- string evLogTxt = "WebMethod: sendRequestXML() has been called by QBWebconnector" + "\r\n\r\n";
- evLogTxt = evLogTxt + "Parameters received:\r\n";
- evLogTxt = evLogTxt + "string ticket = " + ticket + "\r\n";
- evLogTxt = evLogTxt + "string strHCPResponse = " + strHCPResponse + "\r\n";
- evLogTxt = evLogTxt + "string strCompanyFileName = " + strCompanyFileName + "\r\n";
- evLogTxt = evLogTxt + "string qbXMLCountry = " + qbXMLCountry + "\r\n";
- evLogTxt = evLogTxt + "int qbXMLMajorVers = " + qbXMLMajorVers.ToString() + "\r\n";
- evLogTxt = evLogTxt + "int qbXMLMinorVers = " + qbXMLMinorVers.ToString() + "\r\n";
- evLogTxt = evLogTxt + "\r\n";
-
- ArrayList req = buildRequest();
-
-
-
- string request = "";
- int total = req.Count;
- count = Convert.ToInt32(Session["counter"]);
-
- if (count < total)
- {
- request = req[count].ToString();
- evLogTxt = evLogTxt + "sending request no = " + (count + 1) + "\r\n";
- Session["counter"] = ((int)Session["counter"]) + 1;
- }
- else
- {
- count = 0;
- Session["counter"] = 0;
- request = "";
- }
- evLogTxt = evLogTxt + "\r\n";
- evLogTxt = evLogTxt + "Return values: " + "\r\n";
- evLogTxt = evLogTxt + "string request = " + request + "\r\n";
- logEvent(evLogTxt);
-
-
- return request;
-
- }
Get response code:-
- [WebMethod(Description = "This web method facilitates web service to receive response XML from QuickBooks via QBWebConnector", EnableSession = true)]
-
- public int receiveResponseXML(string ticket, string response, string hresult, string message)
- {
-
-
- var reader = XmlReader.Create(new StringReader(response));
- var xml_Doc = XDocument.Load(reader);
-
-
-
-
-
- var nodes = (from n in xml_Doc.Descendants("CustomerRet")
- select new QBClient
- {
- ClientListId = n.Element("ListID").Value,
- ClientId = (from nx in n.Descendants("DataExtRet")
- .Where(x => x.Element("DataExtName").Value.Contains("CRXIS Client Id"))
- select nx.Element("DataExtValue").Value).FirstOrDefault()
- }).ToList() ;
-
-
-
-
- var r=objinvoice.InsertQBClient(nodes);
-
-
-
- var invoiceNumber = (from n in xml_Doc.Descendants("InvoiceRet")
- select n.Element("RefNumber").Value).FirstOrDefault() ;
-
- if (invoiceNumber!=null)
- {
- var result = objinvoice.UpdateQBflag(invoiceNumber.ToString());
- }
-
-
-
-
- string evLogTxt = "WebMethod: receiveResponseXML() has been called by QBWebconnector" + "\r\n\r\n";
- evLogTxt = evLogTxt + "Parameters received:\r\n";
- evLogTxt = evLogTxt + "string ticket = " + ticket + "\r\n";
- evLogTxt = evLogTxt + "string response = " + response + "\r\n";
- evLogTxt = evLogTxt + "string hresult = " + hresult + "\r\n";
- evLogTxt = evLogTxt + "string message = " + message + "\r\n";
- evLogTxt = evLogTxt + "\r\n";
-
- int retVal = 0;
- if (!hresult.ToString().Equals(""))
- {
-
- evLogTxt = evLogTxt + "HRESULT = " + hresult + "\r\n";
- evLogTxt = evLogTxt + "Message = " + message + "\r\n";
- retVal = -101;
- }
- else
- {
- evLogTxt = evLogTxt + "Length of response received = " + response.Length + "\r\n";
-
- ArrayList req = buildRequest();
- int total = req.Count;
- int count = Convert.ToInt32(Session["counter"]);
-
- int percentage = (count * 100) / total;
- if (percentage >= 100)
- {
- count = 0;
- Session["counter"] = 0;
- }
- retVal = percentage;
- }
- evLogTxt = evLogTxt + "\r\n";
- evLogTxt = evLogTxt + "Return values: " + "\r\n";
- evLogTxt = evLogTxt + "int retVal= " + retVal.ToString() + "\r\n";
- logEvent(evLogTxt);
-
- return retVal;
- }
Please resolve this issue.