ajax调用sharepoint托管的wcf服务错误请求
我在Sharepoint 2010中托管了一个WCF服务(因此不需要配置文件-->ServiceHost Factory设置为MultipleBaseAddressWebServiceHostFactory) 我的服务界面:ajax调用sharepoint托管的wcf服务错误请求,ajax,json,wcf,Ajax,Json,Wcf,我在Sharepoint 2010中托管了一个WCF服务(因此不需要配置文件-->ServiceHost Factory设置为MultipleBaseAddressWebServiceHostFactory) 我的服务界面: [OperationContract] [WebInvoke( Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestForma
[OperationContract]
[WebInvoke(
Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
List<Course> GetAllCoursesByPerno(string empPerno);
我的方法:
public List<Course> GetAllCoursesByPerno(string empPerno)
{
.
.
.
.
}
但是没有雪茄。任何帮助都将不胜感激
感谢使用Microsoft ajax库致电。 这也避免了日期时间反序列化问题
Sys.Net.WebServiceProxy.invoke('/_vti_bin/YourSubfolder/SearchService.svc',
'EmptyMethod',
false,
{data: 'client data'},
function () {
console.log('Success', arguments);
},
function () {
console.log('Eroor', arguments);
}, this);
data: '{"empPerno": "' + input + '"}',
data: JSON.stringify({ empPerno : input }),
Sys.Net.WebServiceProxy.invoke('/_vti_bin/YourSubfolder/SearchService.svc',
'EmptyMethod',
false,
{data: 'client data'},
function () {
console.log('Success', arguments);
},
function () {
console.log('Eroor', arguments);
}, this);