我有Quickbooks Desktop Enterprise 18.0。我已经通过web连接器使用qwc文件创建了连接。当我单击从Web连接器更新选定选项时,结果显示没问题。但是,如果我在Web服务中包含客户数据并单击“更新”,则会在状态栏中显示错误,即说明: 通过getLastError()从应用程序收到的错误消息:错误!。
我粘贴下面的代码如果有任何问题,请查看并指导。谢谢。
public ArrayList buildRequest() {
string strRequestXML ="";
XmlDocument inputXMLDoc = null;
// CustomerQuery
inputXMLDoc = new XmlDocument();
inputXMLDoc.AppendChild(inputXMLDoc.CreateXmlDeclaration("1.0",null, null));
inputXMLDoc.AppendChild(inputXMLDoc.CreateProcessingInstruction("qbxml", "version=\"4.0\""));
XmlElement qbXML = inputXMLDoc.CreateElement("QBXML");
inputXMLDoc.AppendChild(qbXML);
XmlElement qbXMLMsgsRq = inputXMLDoc.CreateElement("QBXMLMsgsRq");
qbXML.AppendChild(qbXMLMsgsRq);
qbXMLMsgsRq.SetAttribute("onError", "stopOnError");
XmlElement CustomerAddRq = inputXMLDoc.CreateElement("CustomerAddRq");
qbXML.AppendChild(CustomerAddRq);
qbXMLMsgsRq.SetAttribute("requestID", "1");
XmlElement CustomerAdd = inputXMLDoc.CreateElement("CustomerAdd");
CustomerAddRq.AppendChild(CustomerAdd);
XmlElement Name = inputXMLDoc.CreateElement("Name");
CustomerAdd.AppendChild(Name);
CustomerAdd.AppendChild(Name).InnerText = "Naga";
XmlElement FirstName = inputXMLDoc.CreateElement("FirstName");
CustomerAdd.AppendChild(FirstName);
CustomerAdd.AppendChild(Name).InnerText = "Nagarajan";
XmlElement MiddleName = inputXMLDoc.CreateElement("MiddleName");
CustomerAdd.AppendChild(MiddleName);
XmlElement LastName = inputXMLDoc.CreateElement("LastName");
CustomerAdd.AppendChild(LastName);
CustomerAdd.AppendChild(Name).InnerText = "Varatharajan";
XmlElement BillAddress = inputXMLDoc.CreateElement("BillAddress");
CustomerAdd.AppendChild(BillAddress);
XmlElement Addr1 = inputXMLDoc.CreateElement("Addr1");
BillAddress.AppendChild(Addr1);
BillAddress.AppendChild(Addr1).InnerText = "33/33 st";
XmlElement City = inputXMLDoc.CreateElement("City");
BillAddress.AppendChild(City);
BillAddress.AppendChild(City).InnerText = "Chennai";
XmlElement State = inputXMLDoc.CreateElement("State");
BillAddress.AppendChild(State);
BillAddress.AppendChild(State).InnerText = "TN";
XmlElement Phone = inputXMLDoc.CreateElement("Phone");
CustomerAdd.AppendChild(Phone);
CustomerAdd.AppendChild(Phone).InnerText = "4545455";
//XmlElement customerQueryRq = inputXMLDoc.CreateElement("CustomerQueryRq");
//qbXMLMsgsRq.AppendChild(customerQueryRq);
//customerQueryRq.SetAttribute("requestID", "1");
// XmlElement maxReturned=inputXMLDoc.CreateElement("MaxReturned");
// customerQueryRq.AppendChild(maxReturned).InnerText="1";
strRequestXML = inputXMLDoc.OuterXml;
req.Add(strRequestXML);
}