///<summary>Sends a "jms/stream-message"-encoded RPC request, ///and expects an RPC reply in the same format.</summary> ///<remarks> ///<para> /// The arguments passed in must be of types that are /// representable as JMS StreamMessage values, and so must the /// results returned from the service in its reply message. ///</para> ///<para> /// Calls OnTimedOut() and OnDisconnected() when a timeout or /// disconnection, respectively, is detected when waiting for /// our reply. ///</para> ///<para> /// Returns null if the request timed out or if we were /// disconnected before a reply arrived. ///</para> ///<para> /// The reply message, if any, is acknowledged to the AMQP /// server via Subscription.Ack(). ///</para> ///</remarks> ///<see cref="IStreamMessageBuilder"/> ///<see cref="IStreamMessageReader"/> public virtual object[] Call(params object[] args) { IStreamMessageBuilder builder = new StreamMessageBuilder(Model); builder.WriteObjects(args); IBasicProperties replyProperties; byte[] replyBody = Call((IBasicProperties)builder.GetContentHeader(), builder.GetContentBody(), out replyProperties); if (replyProperties == null) { return null; } if (replyProperties.ContentType != StreamMessageBuilder.MimeType) { throw new ProtocolViolationException (string.Format("Expected reply of MIME type {0}; got {1}", StreamMessageBuilder.MimeType, replyProperties.ContentType)); } IStreamMessageReader reader = new StreamMessageReader(replyProperties, replyBody); return reader.ReadObjects(); }