public object Create(object parent, object configContext, System.Xml.XmlNode section) { SapConfig sapConfig = new SapConfig(); var appServerHost = section.SelectSingleNode("AppServerHost"); if (appServerHost != null && appServerHost.Attributes != null) { var attribute = appServerHost.Attributes["Value"]; if (attribute != null) { sapConfig.AppServerHost = attribute.Value; } } var user = section.SelectSingleNode("User"); if (user != null && user.Attributes != null) { var attribute = user.Attributes["Value"]; if (attribute != null) { sapConfig.User = attribute.Value; } } var password = section.SelectSingleNode("Password"); if (password != null && password.Attributes != null) { var attribute = password.Attributes["Value"]; if (attribute != null) { sapConfig.Password = attribute.Value; } } var client = section.SelectSingleNode("Client"); if (client != null && client.Attributes != null) { var attribute = client.Attributes["Value"]; if (attribute != null) { sapConfig.Client = attribute.Value; } } var systemID = section.SelectSingleNode("SystemID"); if (systemID != null && systemID.Attributes != null) { var attribute = systemID.Attributes["Value"]; if (attribute != null) { sapConfig.SystemID = attribute.Value; } } return(sapConfig); }
public RfcConfigParameters GetParameters(String destinationName) { SapConfig sapConfig = ConfigurationManager.GetSection(destinationName) as SapConfig; if (sapConfig == null) { return(null); } RfcConfigParameters parms = new RfcConfigParameters(); //if (!Properties.Settings.Default.INNER) //{ // parms.Add(RfcConfigParameters.SAPRouter, "/H/210.75.9.162/H/"); //} parms.Add(RfcConfigParameters.AppServerHost, sapConfig.AppServerHost); //SAP主机IP parms.Add(RfcConfigParameters.SystemNumber, "00"); //SAP实例 parms.Add(RfcConfigParameters.User, sapConfig.User); //用户名 parms.Add(RfcConfigParameters.Password, sapConfig.Password); //密码 parms.Add(RfcConfigParameters.Client, sapConfig.Client); // Client parms.Add(RfcConfigParameters.Language, "ZH"); //登陆语言 parms.Add(RfcConfigParameters.PoolSize, "10"); parms.Add(RfcConfigParameters.MaxPoolSize, "100"); parms.Add(RfcConfigParameters.SystemID, sapConfig.SystemID); parms.Add(RfcConfigParameters.IdleTimeout, "60"); AvailableDestinations.Add(destinationName, parms); return(parms); }