Exemplo n.º 1
0
 public void Call <T>(string command, Responder <T> responder, params object[] arguments)
 {
     try
     {
         TypeHelper._Init();
         Invoke           invoke      = new Invoke();
         PendingCall      pendingCall = new PendingCall(command, arguments);
         ResponderHandler handler     = new ResponderHandler(responder);
         pendingCall.RegisterCallback(handler);
         invoke.ServiceCall = pendingCall;
         invoke.InvokeId    = _connection.InvokeId;
         _connection.RegisterPendingCall(invoke.InvokeId, pendingCall);
         Write(invoke);
     }
     catch (Exception ex)
     {
         _netConnection.RaiseNetStatus(ex);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Invokes a command or method on the server to which this connection is connected.
 /// </summary>
 /// <typeparam name="T">Return type from a remote method invocation.</typeparam>
 /// <param name="endpoint">Flex RPC endpoint name.</param>
 /// <param name="destination">Flex RPC message destination.</param>
 /// <param name="source">The name of the service to be called including namespace name.</param>
 /// <param name="operation">The name of the remote method/operation that should be called.</param>
 /// <param name="responder">An optional object that is used to handle return values from the server.</param>
 /// <param name="arguments">Optional arguments. These arguments are passed to the method specified in the command parameter when the method is executed on the remote application server.</param>
 /// <remarks>
 /// For RTMP connection this method throws a NotSupportedException.
 /// </remarks>
 public void Call <T>(string endpoint, string destination, string source, string operation, Responder <T> responder, params object[] arguments)
 {
     _netConnectionClient.Call(endpoint, destination, source, operation, responder, arguments);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Invokes a command or method on the server to which this connection is connected.
 /// </summary>
 /// <typeparam name="T">Return type from a remote method invocation.</typeparam>
 /// <param name="command">A method specified in object path form.</param>
 /// <param name="responder">An optional object that is used to handle return values from the server.</param>
 /// <param name="arguments">Optional arguments. These arguments are passed to the method specified in the command parameter when the method is executed on the remote application server.</param>
 public void Call <T>(string command, Responder <T> responder, params object[] arguments)
 {
     _netConnectionClient.Call(command, responder, arguments);
 }
Exemplo n.º 4
0
        public void Call <T>(string endpoint, string destination, string source, string operation, Responder <T> responder, params object[] arguments)
        {
            if (_netConnection.ObjectEncoding == ObjectEncoding.AMF0)
            {
                throw new NotSupportedException("AMF0 not supported for Flex RPC");
            }
            try
            {
                TypeHelper._Init();

                RemotingMessage remotingMessage = new RemotingMessage();
                remotingMessage.clientId    = Guid.NewGuid().ToString("D");
                remotingMessage.destination = destination;
                remotingMessage.messageId   = Guid.NewGuid().ToString("D");
                remotingMessage.timestamp   = 0;
                remotingMessage.timeToLive  = 0;
                remotingMessage.SetHeader(MessageBase.EndpointHeader, endpoint);
                remotingMessage.SetHeader(MessageBase.FlexClientIdHeader, _netConnection.ClientId ?? "nil");
                //Service stuff
                remotingMessage.source    = source;
                remotingMessage.operation = operation;
                remotingMessage.body      = arguments;

                FlexInvoke       invoke      = new FlexInvoke();
                PendingCall      pendingCall = new PendingCall(null, new object[] { remotingMessage });
                ResponderHandler handler     = new ResponderHandler(responder);
                pendingCall.RegisterCallback(handler);
                invoke.ServiceCall = pendingCall;
                invoke.InvokeId    = _connection.InvokeId;
                _connection.RegisterPendingCall(invoke.InvokeId, pendingCall);
                Write(invoke);
            }
            catch (Exception ex)
            {
                _netConnection.RaiseNetStatus(ex);
            }
        }
Exemplo n.º 5
0
        public void Call <T>(string endpoint, string destination, string source, string operation, Responder <T> responder, params object[] arguments)
        {
            if (_netConnection.ObjectEncoding == ObjectEncoding.AMF0)
            {
                throw new NotSupportedException("AMF0 not supported for Flex RPC");
            }
            try
            {
                TypeHelper._Init();

                Uri            uri     = new Uri(_gatewayUrl);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                request.ContentType = ContentType.AMF;
                request.Method      = "POST";
#if !(SILVERLIGHT)
                request.CookieContainer = _netConnection.CookieContainer;
#endif
                AMFMessage amfMessage = new AMFMessage((ushort)_netConnection.ObjectEncoding);

                RemotingMessage remotingMessage = new RemotingMessage();
                remotingMessage.clientId    = Guid.NewGuid().ToString("D");
                remotingMessage.destination = destination;
                remotingMessage.messageId   = Guid.NewGuid().ToString("D");
                remotingMessage.timestamp   = 0;
                remotingMessage.timeToLive  = 0;
                remotingMessage.SetHeader(MessageBase.EndpointHeader, endpoint);
                remotingMessage.SetHeader(MessageBase.FlexClientIdHeader, _netConnection.ClientId ?? "nil");
                //Service stuff
                remotingMessage.source    = source;
                remotingMessage.operation = operation;
                remotingMessage.body      = arguments;

                foreach (KeyValuePair <string, AMFHeader> entry in _netConnection.Headers)
                {
                    amfMessage.AddHeader(entry.Value);
                }
                AMFBody amfBody = new AMFBody(null, null, new object[] { remotingMessage });
                amfMessage.AddBody(amfBody);

                AmfRequestData amfRequestData = new AmfRequestData(request, amfMessage, null, null, responder);
                request.BeginGetRequestStream(BeginRequestFlexCall, amfRequestData);
            }
            catch (Exception ex)
            {
                _netConnection.RaiseNetStatus(ex);
            }
        }