我正在使用salesforce API,并且有一个返回SaveResult数组的助手类。我使用了try/catch块,并且在catch块中使用了SoapException,但是没有找到名称空间。我不确定我应该使用什么using指令?
接口指南中的示例将SoapException显示为有效类型。
下面是我的方法:
private SaveResult[] CreateObjects(sObject[] objectArray)
{
try
{
SaveResult[] saveResults = this.binding.create(objectArray);
for (int i = 0; i < saveResults.Length; i++)
{
if (saveResults[i].success)
{
Console.WriteLine("An object was created with Id: {0}", saveResults[i].id);
}
else
{
Console.WriteLine("Item {0} had an error updating", i);
foreach (Error error in saveResults[i].errors)
{
Console.WriteLine("Error code is: {0}",
error.statusCode.ToString());
Console.WriteLine("Error message: {0}", error.message);
}
}
}
return saveResults;
}
catch (SoapException e)
{
Console.WriteLine(e.Code);
Console.WriteLine(e.Message);
}
return null;
}任何帮助都是非常感谢的。谢谢。
发布于 2013-05-25 06:23:06
它的库提供了SoapException类,请参阅http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapexception.aspx
https://stackoverflow.com/questions/16744243
复制相似问题