分配给变量的值的类型(空)

时间:2020-09-08 12:33:58

标签: error-handling ssis

有什么办法可以避免SSIS程序包中的此错误?

该程序包使用Web服务任务调用Web服务方法。将该响应放入String类型的SSIS变量中,然后进行进一步处理。

有时该方法返回一个Empty响应;我无法控制它,因为它不是我的Web服务。这种响应是一种已知的可能性:当传递给该方法的GUID在Web服务后面的任何存储中都找不到匹配的行时,就会发生这种响应。我要处理此错误。麻烦的是(请参阅相关的question),这个特定的错误使我的SSIS错误处理陷入困境,直接进入程序包错误处理程序。

完整的错误文本为:

An error occurred with the following error message: "Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: The type of the value (Empty) being assigned to variable "User::WSResponse" differs from the current variable type (String). Variables may not change type during execution. Variable types are strict, except for variables of type Object.   ---> System.Runtime.InteropServices.COMException: The type of the value (Empty) being assigned to variable "User::WSResponse" differs from the current variable type (String). Variables may not change type during execution. Variable types are strict, except for variables of type Object.       at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariable100.set_Value(Object pvValue)     at Microsoft.SqlServer.Dts.Runtime.Variable.set_Value(Object value)     --- End of inner exception stack trace ---     at Microsoft.SqlServer.Dts.Runtime.Variable.set_Value(Object value)     at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.saveOutputToVariable(Object output)     at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".  

我在想的是这样的东西:

  1. 对[可以处理Empty的某些SSIS数据类型进行响应-有吗?]
  2. 值是否为空?如果是这样,可以通过发出行为良好的SSIS错误来解决此问题。
  3. 否则,将值转换为SSIS字符串并继续。

编辑 奇怪的是,如果我选择文件作为输出而不是变量,则Web服务任务不会 not 返回Empty。在这种情况下,它将返回以下内容:

<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<Result>The result is null. Either the result is null or the Web method returns void.</Result>

不过,不确定我是否要开始写SSIS包中的文件系统或从中读取文件。

无论是Web服务本身,还是Web服务任务,似乎都带有****的错误。

0 个答案:

没有答案