2

我对 WCF 服务一无所知。我来自java背景。我需要使用WCF serviceiehttp://192.168.1.5/xeservices/AccountManagement.svcjqueryajax我不知道如何使用它。我的系统中也没有 .net。从服务中我发现我应该有svcutils.exe命令创建客户端。我知道,通过安装 Microsoft SDK 我可以得到它。请任何人告诉我如何实现我的目标。

4

3 回答 3

2

无需安装 .Net 或其框架,直接使用 WCF URL 使用 AJAX 和 Jquery。

于 2013-05-14T07:41:52.553 回答
1

尝试这个

对于 Json 类型结果

在界面中

[WebInvoke(Method = "POST", UriTemplate = "/ItemGetItem?id={id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
void  ItemGetItem(string id);

在脚本中

self.GetItem= function () {
         try {
             $.ajax({
                 type: "POST",
                 url: "Your Url",
                 contentType: 'application/json',
                 async: false,
                 dataType: 'json',
                 cache: false,
                 success: function (response) {
                      //Do some stuff here with Data
                 },
                 error: function (ErrorResponse) {
                      //Handle error
                 }
            });
         }
         catch (error) {

         }
     }

放置客户端应用程序的端点以使用此服务

于 2013-05-14T11:19:43.660 回答
1

如果你WCF Service是这样写的,就像在CodeProject links评论中一样,你可以访问一个WCF Service类似的 javascript 片段显示。

http://www.codeproject.com/Articles/132809/Calling-WCF-Services-using-jQuery

于 2013-05-14T10:48:30.857 回答