コード例 #1
0
 public void ReadMSG(MsgProtocol msgProtocol, byte[] msg)
 {
     if (onlineComponents.Count > 0)
     {
         onlineComponents.Find(item => item.MsgProtocol == msgProtocol).ReadMSG(msg);
     }
 }
コード例 #2
0
        public static string getContentType(MessageFormat.MessageContentType messageContentType = MessageFormat.MessageContentType.Xml,
                                            MsgProtocol msgProtocol = MsgProtocol.Interop)
        {
            string contentType = "application/";

            if (msgProtocol == MsgProtocol.SOAP)
            {
                contentType += "soap+";
            }

            switch (messageContentType)
            {
            case MessageFormat.MessageContentType.Xml:
                contentType += "xml";
                break;

            case MessageFormat.MessageContentType.FastInfoSet:
                contentType += "fastinfoset";
                break;

            case MessageFormat.MessageContentType.Json:
                contentType += "json";
                break;

            ////text/csv+tab
            case MessageFormat.MessageContentType.CSVTab:
                contentType = "text/csv+tab";
                break;

            default:
                throw new Exception("Can't parse unsupported ContentType for request, not able to send request.");
            }
            return(contentType);
        }
コード例 #3
0
 public CommunicationInformation(String uri, MsgProtocol protocol = MsgProtocol.Interop, MessageFormat.MessageContentType contentType = MessageFormat.MessageContentType.FastInfoSet,
                                 MessageEncodeDecode.MessageContentEncoding contentEncoding = MessageEncodeDecode.MessageContentEncoding.None, bool withE3JRequestHeader = true, HTTPSendMode httpSendMode = HTTPSendMode.POST)
 {
     this.URI             = uri;
     this.MessageProtocol = protocol;
     this.ContentType     = contentType;
     this.ContentEncoding = contentEncoding;
     this.HttpSendMode    = httpSendMode;
     WithE3JRequestHeader = withE3JRequestHeader;
 }
コード例 #4
0
        public static MemoryStream DetachProtocol(MemoryStream ms, MsgProtocol mp)
        {
            if (mp == MsgProtocol.SOAP)
            {
                return(SOAPProtocol.GetSOAPBody(ms));
            }
            else if (mp == MsgProtocol.Interop)
            {
                return(ms); // There is no Header
            }

            throw new ArgumentOutOfRangeException("commInfo.MessageProtocol");
        }
コード例 #5
0
    static int _CreateMsgProtocol(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            MsgProtocol obj = new MsgProtocol();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: MsgProtocol.New");
        }

        return(0);
    }
コード例 #6
0
        public static string getContextType(MessageFormat.MessageContentType messageContentType = MessageFormat.MessageContentType.Xml,
                                            MsgProtocol msgProtocol = MsgProtocol.Interop)
        {
            string contextType = "";

            if (messageContentType == MessageFormat.MessageContentType.FastInfoSet && msgProtocol == MsgProtocol.Interop)
            {
                contextType = "application/fastinfoset";
            }
            if (messageContentType == MessageFormat.MessageContentType.Xml && msgProtocol == MsgProtocol.Interop)
            {
                contextType = "application/xml";
            }
            if (messageContentType == MessageFormat.MessageContentType.FastInfoSet && msgProtocol == MsgProtocol.SOAP)
            {
                contextType = "application/soap+fastinfoset";
            }
            if (messageContentType == MessageFormat.MessageContentType.Xml && msgProtocol == MsgProtocol.SOAP)
            {
                contextType = "application/soap+xml";
            }

            return(contextType);
        }