简体   繁体   English

Jayrock:未导出Web方法

[英]Jayrock: web methods not exported

I'm trying to figure out what I'm doing wrong with a simple Jayrock JSON-RPC service. 我试图找出一个简单的Jayrock JSON-RPC服务在做什么。

Basically, I'm writing a JSON proxy for a .NET WCF web service so that iPhones can use it. 基本上,我正在为.NET WCF Web服务编写JSON代理,以便iPhone可以使用它。 The SOAP service insterface is working so I'm just implementing a service instance in my Jayrock handler and calling the corresponding methods. SOAP服务界面正在运行,因此我仅在Jayrock处理程序中实现服务实例并调用相应的方法。

Unfortunately, and although I had no issues with my test project, when I do that with the actual application, none of the Jayrock web methods that I marked as JsonRpcMethod are exported. 不幸的是,尽管我的测试项目没有问题,但是当我在实际的应用程序中执行该操作时,我标记为JsonRpcMethod的Jayrock Web方法都不会导出。 All I see is the 3 default methods. 我所看到的是3种默认方法。

I disconnected all the other methods, in case there was some interference and I'm still not seeing anything. 我断开了所有其他方法的连接,以防万一有干扰并且仍然看不到任何东西。 Any suggestion as to what I could be doing wrong ? 关于我可能做错了什么建议?

Here is my generic handler code: 这是我的通用处理程序代码:

using System;
using System.Web;
using Jayrock.Json;
using Jayrock.JsonRpc;
using Jayrock.JsonRpc.Web;
using WimotiDTO.DataContract;

namespace WimotiWS
{
    /// <summary>
    ///  Summary description for JSONEndpoint
    /// This class implement a JSon proxy for the Wimoti web service
    /// </summary>
    public class JSONEndpoint : JsonRpcHandler
    {
        [JsonRpcMethod("Test")]
        string Test()
        {
            return "Yeeha!";
        }
    }
}

And here is the page: 这是页面:

<%@ WebHandler Language="C#" CodeBehind="JSONEndpoint.ashx.cs" Class="WimotiWS.JSONEndpoint"%>

Finally, calling the method list method returns: 最后,调用方法列表方法将返回:

["system.listMethods","system.version","system.about"]

The class attribute should be used: 应该使用class属性:

[JsonRpcService("Handler")]
public class Handler : JsonRpcHandler, IRequiresSessionState

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM