Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Sharepoint 2010 Web Services ASMX中的SQL CLR函数时出错_Sql_Web Services_Sharepoint_Clr - Fatal编程技术网

使用Sharepoint 2010 Web Services ASMX中的SQL CLR函数时出错

使用Sharepoint 2010 Web Services ASMX中的SQL CLR函数时出错,sql,web-services,sharepoint,clr,Sql,Web Services,Sharepoint,Clr,执行SQL存储过程时出错。。正在从sharepoint 2010 asmx services获取数据 请参阅下面我的存储过程代码: USE [PMTReporting] GO /****** Object: StoredProcedure [dbo].[SP_Dashboard_AgentLevelReport] Script Date: 10/23/2013 12:46:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER O

执行SQL存储过程时出错。。正在从sharepoint 2010 asmx services获取数据

请参阅下面我的存储过程代码:

USE [PMTReporting]
GO
/****** Object:  StoredProcedure [dbo].[SP_Dashboard_AgentLevelReport]    Script Date: 10/23/2013 12:46:52 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER procedure [dbo].[SP_Dashboard_AgentLevelReport]
@StartRecordDate DATE,
@EndRecordDate DATE,
@EmployeeIDs NVARCHAR(MAX)

AS
BEGIN

/** Create CAML Query for start and end Record Date Parameters**/

DECLARE @NVAR_StartCAML NVARCHAR(10)
DECLARE @NVAR_EndCAML NVARCHAR(10)
DECLARE @NVAR_StartEndRecordDateCAML NVARCHAR(500)
DECLARE @NVAR_CAMLQuery NVARCHAR(MAX)

SET @NVAR_StartCAML = '<Where>'
SET @NVAR_EndCAML = '</Where>'

SET @StartRecordDate = '2011-01-01'
SET @EndRecordDate = '2013-09-10'

SET @NVAR_StartEndRecordDateCAML = '<And><Geq><FieldRef Name="RecordDate" /><Value IncludeTimeValue="TRUE" Type="DateTime">' + CAST(@StartRecordDate AS NVARCHAR) + '</Value></Geq><Leq><FieldRef Name="RecordDate" /><Value IncludeTimeValue="TRUE" Type="DateTime">' + CAST(@EndRecordDate AS NVARCHAR) + '</Value></Leq></And>' 


SELECT * FROM dbo.fn_GetListItemsActivities('http://wks10953:1000/_vti_bin/Lists.asmx','Activities','',@NVAR_StartEndRecordDateCAML)
order by RecordDate


END
下面是一个错误:

Msg 6522,16级,状态1,程序SP_Dashboard_AgentLevel Report,第28行 在执行用户定义例程或聚合“fn_GetListItemsActivities”期间发生.NET Framework错误: System.Net.WebException:请求失败,HTTP状态为401:未经授权。 System.Net.WebException: 位于System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage消息、WebResponse响应、Stream responseStream、Boolean异步调用) 位于System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,Object[]参数) 在WSS.Lists.GetListItems(字符串listName、字符串viewName、XmlNode查询、XmlNode视图字段、字符串行限制、XmlNode查询选项、字符串webID) 位于SharePointActivities.GetActivitiesItems(SqlString url、SqlString listName、SqlString viewName、SqlString查询)

请参阅下面的错误,当我在SSRS 2008 r2中调用我的过程时,我得到了这个错误 有时,它运行得非常好,当它给出以下错误时,我的所有CLR函数都无法工作,这些函数与sharepoint asmx webservices相关,并给出相同的错误

    Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "fn_GetListItemsEmployees": 
System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
System.Net.WebException: 
 at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
 at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
 at WSS.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID)
 at SharePointEmployees.GetEmployeesItems(SqlString url, SqlString listName, SqlString viewName).
现在我所有的CLR函数都生效了,并且给出了这种错误。。。所以我找不到这个问题是什么


请在这方面帮助我

是否所有SQL CLR函数都试图访问ASMX web服务?另外,什么代码正在执行
exec[dbo].[SP_Dashboard\u AgentLevelReport]''',''
调用?你在SSMS上运行这个吗?从Web应用程序,还是从何处?您可能需要阅读。进一步查看堆栈跟踪,这似乎不是问题。似乎正在发出web服务调用,并且服务器拒绝了该调用,并出现401错误。您认为您将使用哪些凭据?您是否尝试使用Windows身份验证?您是否试图将标识从调用方传递到SQL Server、CLR SP,然后通过Web服务调用?好像跳得太多了。请检查我的代码C#代码。。在这个问题中:我正在本地系统上从sharepoint web应用程序运行SSMS。。但它将在我的服务器上使用
    Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "fn_GetListItemsEmployees": 
System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
System.Net.WebException: 
 at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
 at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
 at WSS.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID)
 at SharePointEmployees.GetEmployeesItems(SqlString url, SqlString listName, SqlString viewName).