2012-05-09 3 views
0

amf remoting을 사용하여 asp.net mvc 액션에 대한 호출을 플래시에서 수행 할 수 있는지 알고있는 사람은 누구입니까?amf remoting with asp.net mvc

그렇다면 어떻게됩니까? 어떤 기술이 사용되어야하고,이 같은 것 플래시 측에서 그들에게

을 결합하는 방법 :

//Connect the NetConnection object 
    var netConnection: NetConnection = new NetConnection(); 
    netConnection.connect("http://localhost:59147/Home/Index"); 

    //Invoke a call 
    log("invoke call TestMethod"); 
    var responder : Responder = new Responder(handleRemoteCallResult, handleRemoteCallFault); 
    netConnection.call('TestMethod', responder, "Test"); 

내가 이것을 시도하고 작업을 명중하지만 난 'TestMethod'을 (를) 찾을 수 없습니다 및 요청

에서 "테스트"Anyware를 당신은

+0

.NET 클라이언트 AMF 라이브러리를 사용하려고 했습니까? http://en.wikipedia.org/wiki/Action_Message_Format#Support_for_AMF에 대한 목록이 있습니다. –

+0

@AntonioBakula FluorineFx를 사용해 보았지만 RemoteObjects에서만 작동합니다. 플래시 쪽을 바꾸면 NetConnection이 위의 방법대로 사용됩니다. – Omu

답변

2

나는 완전한 답변이없는 감사, 그러나 이것은 시작에 도움이 있었다.

FluorineFx를 사용하면 모든 AMF 항목을 구현하고 AMFWriter/Reader, AMFDeserializer 등을 사용할 수 있으므로 좋은 시작이 될 수 있습니다.

using System.Web.Mvc; 
using FluorineFx.IO; 

public class AMFFilterAttribute : ActionFilterAttribute 
{ 
    public override void OnActionExecuting(ActionExecutingContext filterContext) 
    { 
     if (filterContext.HttpContext.Request.ContentType == "application/x-amf") 
     { 
      var stream = filterContext.HttpContext.Request.InputStream; 

      var deserializer = new AMFDeserializer(stream); 
      var message = deserializer.ReadAMFMessage(); 

      foreach (var body in message.Bodies) // not foreach, just the first one 
      { 
       filterContext.ActionParameters["method"] = body.Target; 
       filterContext.ActionParameters["args"] = body.Content; 
      } 

      base.OnActionExecuting(filterContext); 
     } 
    } 
} 

[AMFFilter] 
[HttpPost] 
public ActionResult Index(string method, object[] args) 
{ 
    return View(); 
} 

이것은 처음 부분입니다. 바이너리 데이터와 물건을 반환하는 것은 일종의 커스텀 ActionResult에 의해 처리 될 수 있지만 여기에서 어떻게 해야할지 알고 계신 분 AMF ActionResult for asp.net mvc?

행운을 빈다.

+0

고맙습니다. 객체를 보낼 때를 제외하고는 C# 측에서 사전을 가져옵니다. 객체에 deserialize 할 수 있는지 알고 있습니까? – Omu

+1

좋아,이 하나를 발견, 나는 이것을 사용 : http://www.fluorinefx.com/docs/fluorine/classmappingas3.html 그리고 지금 매핑 개체로. – Omu

+0

@ChuckNorris 클래스 매핑 및 별칭, 예! IExternalizable을 통해 사용자 지정 직렬화를 사용할 때 트래픽을 절약 할 수 있습니다 (그러나 클라이언트 측을 변경할 수없는 경우에는 사용할 수 없습니다) –