Vyd*_*ope 3 .net c# web-services servicenow
我试图从.Net调用Service Now的web服务,我可以使它在插入记录时工作正常,但我无法使用任何GET工作.这是我的工作INSERT代码:
public void insertTable(string tableName, string schema, string columnInfo, string shortDesrcipt, string longDescript)
{
using (ServiceNow_u_database_table tableReference = new ServiceNow_u_database_table())
{
insertResponse response = new insertResponse();
System.Net.ICredentials cred = new System.Net.NetworkCredential(Properties.Settings.Default.UserName, Properties.Settings.Default.Password);
tableReference.Credentials = cred;
insert tableInsert = this.getTableData(tableName, schema, columnInfo, shortDesrcipt, longDescript);
try
{
response = tableReference.insert(tableInsert);
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}
}
}
Run Code Online (Sandbox Code Playgroud)
这很好.以下代码不适用于GET:
using (ServiceNow_u_database_table tableReference = new ServiceNow_u_database_table())
{
ServiceNowExport.com.servicenow.libertydev.u_database_table.getRecords recordGet = new getRecords();
System.Net.ICredentials cred = new System.Net.NetworkCredential(Properties.Settings.Default.UserName, Properties.Settings.Default.Password);
tableReference.Credentials = cred;
recordGet.name = this._tablePrefix + tableName;
getRecordsResponseGetRecordsResult[] response = tableReference.getRecords(recordGet);
if (response != null && response.Count() > 0)
{
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行该代码时,response总是如此null.我下面就说明这个页面.
我知道它正在连接,因为如果我杀了凭证行,我会收到未经授权的错误.我在这里做错了什么想法?谢谢!
| 归档时间: |
|
| 查看次数: |
7213 次 |
| 最近记录: |