我已经在这方面工作了两个星期而且无法得到答案。
我需要使用Visual Studio 2012将Web服务中的数据导入gridview。 wdls在这里:https://home-c8.incontact.com/insidews/insidews.asmx 我需要的 https://login.incontact.com/insidews/insidews.asmx?op=DataDownloadReport_Run方法。
到目前为止我所拥有的是:
//created service reference called icContact
//Created Credentials
icContactSR.inCredentials cr = new icContactSR.inCredentials();
cr.busNo = xxxxxx;
cr.password = "xxxxxxx";
DateTime startDate = new DateTime(2013, 12, 27, 8, 00, 00);
DateTime endDate = new DateTime(2013, 12, 27, 9, 00, 00);
//create request
icContactSR.DataDownloadReport_RunRequest request =
new `DataDownloadReport_RunRequest(cr, reportnumber, startDate, endDate);`
//get response
icContactSR.DataDownloadReport_RunResponse response = new
icContactSR.DataDownloadReport_RunResponse();
//fill dataset with response
DataSet ds = (DataSet)response.DataDownloadReport_RunResult;
GridView1.DataSource = ds.ReadXml(response.ToString());
GridView1.DataBind();
我当前的错误:(ds.readXml(response.toString()); 异常详细信息:System.NullReferenceException:未将对象引用设置为对象的实例。
我觉得我很接近找到答案,但我不知道它是不是根本不知道如何从响应中填充数据集,或者我是否得到了回复。 每次运行它时,我的数据集都为空。 任何帮助将不胜感激。
答案 0 :(得分:0)
你可以试试这个
// object to InContact Web Service reference
var client = new icContactSR.inSideWS()
{
inCredentialsValue = new icContactSR.inCredentials()
{
password = ******,
busNo = ******,
timeZoneName = "UTC"
}
};
DateTime startDate = new DateTime(2013, 12, 27, 8, 00, 00);
DateTime endDate = new DateTime(2013, 12, 27, 9, 00, 00);
DataSet dsCallDetails = client.DataDownloadReport_Run(report_number, startDate.ToUniversalTime(), endDate.ToUniversalTime());
GridView1.DataSource = dsCallDetails.Tables[0];
GridView1.DataBind();