// </Snippet1> public override object GetInitializer(LogicalMethodInfo lmi, SoapExtensionAttribute sea) { // method added so sample will compile object myobject = new Object(); return(myobject); }
public override object GetInitializer( LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { //return null; return(((ReverserExtensionAttribute)attribute).Filename); }
/// <summary> /// Used to get the initializer object for SOAP extension that /// is configured for entire web serice. /// </summary> /// <param name="methodInfo">Method being processed, if there is one</param> /// <param name="attribute">Attribute being processed</param> /// <returns>Object that will be passed to code that processes web method invocations</returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { Argument.Assert.IsNotNull(methodInfo, "methodInfo"); Argument.Assert.IsNotNull(attribute, "attribute"); return(GetInitializerHelper(methodInfo.DeclaringType, methodInfo, attribute)); }
public override object GetInitializer ( LogicalMethodInfo methodInfo , SoapExtensionAttribute attribute ) { return(null); }
/// <summary> /// When the SOAP extension is accessed for the first time, the XML Web /// service method it is applied to is accessed to store the file /// name passed in, using the corresponding SoapExtensionAttribute. /// </summary> /// <param name="methodInfo">The method being called.</param> /// <param name="attribute">Decorating attribute for the method.</param> /// <returns>An initializer object.</returns> /// <exception cref="ArgumentNullException">Thrown if /// <paramref name="methodInfo"/> is null.</exception> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { if (methodInfo == null) { throw new ArgumentNullException("methodInfo"); } return(methodInfo.DeclaringType); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { if (!(attribute is ValidationAttribute)) { throw new NotSupportedException("Schematron validation must be enabled through the ValidationAttribute."); } return(new ExtensionInitializer(methodInfo.DeclaringType.Assembly, (ValidationAttribute)attribute)); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { if (attribute == null) { throw new ArgumentNullException("attribute"); } object ret = attribute; return ret; }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { YMLAttribute attr = attribute as YMLAttribute; if (attr != null) { return(attr.Disabled); } return(false); }
//-- The SOAP extension was configured to run using attribute. //-- GetInitializer is called once, the first time the class is used the returned object is then cached and passed to initialize each //-- time a new instance is created and used. public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { ValidationAttribute _va = attribute as ValidationAttribute; if (_va == null) { throw new Exception("Unsupported initializer type"); } if (_va.Namespace.Equals("")) { throw new Exception("Namespace not specified"); } if (_va.SchemaLocation.Equals("")) { throw new Exception("Schema location not specified"); } schemaCache.Add(_va.Namespace, HttpContext.Current.Server.MapPath(_va.SchemaLocation)); schemaCache.Add("http://schemas.xmlsoap.org/soap/envelope/", HttpContext.Current.Server.MapPath("soapenvelope.xml")); schemaCache.Add("http://schemas.xmlsoap.org/soap/encoding/", HttpContext.Current.Server.MapPath("soapencoding.xml")); return(schemaCache); }
/// <summary> /// Allows the SdmxSoapValidator soap extension to initialise the <see cref="InitializerValueObject"/> and <see cref="SchemaCache"/> /// This GetInitializer overload is called from applying <see cref="SdmxSoapValidatorAttribute"/> to Web Methods /// <seealso cref="System.Web.Services.Protocols.SoapExtension.GetInitializer(System.Web.Services.Protocols.LogicalMethodInfo, System.Web.Services.Protocols.SoapExtensionAttribute)"/> /// </summary> /// <param name="methodInfo"> /// A <see cref="System.Web.Services.Protocols.LogicalMethodInfo"/> representing the specific function prototype for the XML Web service method to which the SOAP extension is applied. /// </param> /// <param name="attribute"> /// The <see cref="SdmxSoapValidatorAttribute"/> applied to the XML Web service method. /// </param> /// <returns> /// The <see cref="InitializerValueObject"/> object /// </returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(this.GetInitiliaserCommon(methodInfo.MethodInfo.ReflectedType, methodInfo.Name)); }
/// <summary> /// Přepsání metody GetInitializer, ktera je volana pri volani WebMethody /// </summary> /// <param name="methodInfo">Informace o metodě, na kterou je extenze aplikována</param> /// <param name="attribute">Instance třídy <see cref="SpySoapExtensionAttribute"/>, z ní je odvozen název souboru do kterého mají být ukládány SOAP zprávy</param> /// <returns>Název souboru, do kterého budou uloženy SOAP zprávy</returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { SpyExtensionAttribute spyAttribute = attribute as SpyExtensionAttribute; return(spyAttribute.FileName); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { throw new NotImplementedException(); }
// Return the filename that is to log the SOAP messages. public override object GetInitializer(LogicalMethodInfo myMethodInfo, SoapExtensionAttribute mySoapExtensionAttribute1) { return(((MySoapExtensionAttribute)mySoapExtensionAttribute1).Filename); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(CreateAlgorithm()); }
//Never needed to use this initializer, but it has to be implemented public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { throw new NotImplementedException(); //return ((TraceExtensionAttribute)attribute).Filename; }
// When the SOAP extension is accessed for the first time, the XML Web // service method it is applied to is accessed to store the file // name passed in, using the corresponding SoapExtensionAttribute. public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return ((TraceExtensionAttribute) attribute).Filename; }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(((DimeExtensionAttribute)attribute).DimeDirection); //return null; }
/// <inheritdoc /> /// <summary> /// The get initializer, see documentation reference. /// </summary> /// <param name="methodInfo"> /// The method info. /// </param> /// <param name="attribute"> /// The attribute. /// </param> /// <returns> /// The <see cref="T:System.Object" />. /// </returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { //Logger.Debug("GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)"); return(null); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(((CompressAttribute)attribute).MinLength); }
/// <summary> /// When the SOAP extension is accessed for the first time, the XML Web service method it is applied to /// is accessed to store the file name passed in, using the corresponding SoapExtensionAttribute. /// </summary> /// <param name="methodInfo">A <see cref="LogicalMethodInfo"/> methodInfo.</param> /// <param name="attribute">A <see cref="SoapExtensionAttribute"/> object.</param> /// <returns>An <see cref="object"/> obejct.</returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { // keep = ((SharedCacheSoapExtensionAttribute)attribute).CacheInSecond; return(attribute); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return false; }
// When the SOAP extension is accessed for the first time, the XML Web // service method it is applied to is accessed to store the file // name passed in, using the corresponding SoapExtensionAttribute. public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { Console.WriteLine("testing"); return(((TraceExtensionAttribute)attribute).Filename); }
/// <summary> /// 在Xml Web Service第一次运行的时候,一次性的将通过TraceExtensionAttribute传递进来的 /// 保存日志信息的文件名初始化 /// </summary> /// <param name="methodInfo">应用 SOAP 扩展的 XML Web services 方法的特定函数原型</param> /// <param name="attribute">应用于 XML Web services 方法的 SoapExtensionAttribute</param> /// <returns>SOAP 扩展将对其进行初始化以用于缓存</returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(((SoapTraceExtensionAttribute)attribute).ExtensionType); }
/// <summary> /// When the SOAP extension is accessed for the first time, the XML Web /// service method it is applied to is accessed to store the file /// name passed in, using the corresponding SoapExtensionAttribute. /// </summary> /// <param name="methodInfo"></param> /// <param name="attribute"></param> /// <returns></returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(((SoapLoggerExtensionAttribute)attribute).FileName); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { UDDIExtensionAttribute attr = (UDDIExtensionAttribute)attribute; return(new Data(attr.log, attr.validate, attr.performance, attr.authenticate, attr.transaction, attr.https, attr.certificate, attr.messageType)); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { //return ((TraceExtensionAttribute)attribute).Filename; return(null); }
/// <summary> /// When the SOAP extension is accessed for the first time, the XML Web service method it is applied to /// is accessed to store the file name passed in, using the corresponding SoapExtensionAttribute. /// </summary> /// <param name="methodInfo"></param> /// <param name="attribute"></param> /// <returns></returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(((SOAPTraceRequestAttribute)attribute).Filename); }
// Methods public abstract virtual object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { }
// When the SOAP extension is accessed for the first time, the XML Web // service method it is applied to is accessed to store the file // name passed in, using the corresponding SoapExtensionAttribute. public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { //return ((TraceLogAttribute)attribute).Filename; //return null; return(AppDomain.CurrentDomain.BaseDirectory + "\\log\\soap.log"); }
/// <summary> /// When overridden in a derived class, allows a SOAP extension to initialize data specific to an XML Web service method /// using an attribute applied to the XML Web service method at a one time performance cost. /// </summary> /// <param name="methodInfo">A <see cref="LogicalMethodInfo" /> representing the specific function prototype for the XML Web service method to which the SOAP extension is applied.</param> /// <param name="attribute">The <see cref="SoapExtensionAttribute" /> applied to the XML Web service method.</param> /// <returns> /// The <see cref="Object" /> that the SOAP extension initializes for caching. /// </returns> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(Application.Current.Resources["bootstrapper"]); }
/// <summary> /// Used to get the initializer object for SOAP extension when /// it is being used on the web service. /// </summary> /// <param name="serviceType">Web service</param> /// <param name="methodInfo">Method being processed, if there is one</param> /// <param name="attribute">Attribute being processed</param> /// <returns>Object that will be passed to code that processes web method invocations</returns> private static object GetInitializerHelper(Type serviceType, LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { ValidationContext validationContext = new ValidationContext(); // cache ValidationAttribute for future use validationContext.ValidationAttribute = (ValidationAttribute)attribute; // temporary document/navigator for compiling XPath expressions XmlDocument doc = new XmlDocument(); XPathNavigator nav = doc.CreateNavigator(); // namespace manager for holding all namespace bindings XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nav.NameTable); // retrieve (user-provided) namespace binding attributes object[] namespaceAtts = serviceType.GetCustomAttributes(typeof(AssertNamespaceBindingAttribute), true); foreach (AssertNamespaceBindingAttribute bindingAttribute in namespaceAtts) { namespaceManager.AddNamespace(bindingAttribute.Prefix, bindingAttribute.Namespace); } // store namespace manager in context for future use validationContext.NamespaceManager = namespaceManager; // retrieve (user-provided) assertion attributes AssertAttribute[] allRuleAtts; object[] classRuleAtts = serviceType.GetCustomAttributes(typeof(AssertAttribute), true); if (methodInfo != null) // enabled via custom SoapExtensionAttribute { // retrieve (user-provided) method and class-level assert attributes object[] methodRuleAtts = methodInfo.GetCustomAttributes(typeof(AssertAttribute)); allRuleAtts = new AssertAttribute[methodRuleAtts.Length + classRuleAtts.Length]; methodRuleAtts.CopyTo(allRuleAtts, 0); classRuleAtts.CopyTo(allRuleAtts, methodRuleAtts.Length); } else { // just retrieve (user-provided) class-level assertion attributes allRuleAtts = (AssertAttribute[])classRuleAtts; } // store all assertions in context validationContext.AssertAttributes = allRuleAtts; // generate, compile, and cache XPath expressions for future use StringBuilder completeExpression = new StringBuilder(); string and = string.Empty; foreach (AssertAttribute assertAttribute in allRuleAtts) { string rule = string.Format("boolean({0})", assertAttribute.Rule); // cache compiled expression for future use assertAttribute.Expression = nav.Compile(rule); assertAttribute.Expression.SetContext(namespaceManager); completeExpression.Append(and); completeExpression.Append(rule); and = " and "; } if (completeExpression.Length != 0) { // complete expression (combination off all asserts) for quick success/failure check validationContext.CompleteRuleExpression = nav.Compile(completeExpression.ToString()); validationContext.CompleteRuleExpression.SetContext(namespaceManager); } if (validationContext.ValidationAttribute.SchemaValidation) { // XML Schema cache for schema validation XmlSchemaSet xmlSchemaCollection = new XmlSchemaSet(); // load SOAP 1.1 schema from assembly resource file LoadSchemaFromResourceFile(xmlSchemaCollection, "Resources.ValidationResources", Assembly.GetExecutingAssembly().FullName, "SOAP1.1"); if (validationContext.CurrentEndpoint == Endpoint.Server) { // load from xsd directory by default LoadSchemasFromDirectory(xmlSchemaCollection, "xsd"); // load automatically-generated XML Schema for current endpoint (in case it hasn't already been loaded) LoadReflectedSchemas(xmlSchemaCollection, serviceType, HttpContext.Current.Request.RawUrl); } else { // on client side schemas are embeded as attributes object[] schemaAtts = serviceType.GetCustomAttributes(typeof(ValidationSchemaValueAttribute), true); foreach (ValidationSchemaValueAttribute schema in schemaAtts) { xmlSchemaCollection.Add(schema.Schema); } } // load schemas from user-defined vroot caches object[] schemaCacheAtts = serviceType.GetCustomAttributes(typeof(ValidationSchemaCacheAttribute), true); if (schemaCacheAtts.Length == 0) { foreach (ValidationSchemaCacheAttribute schemaCacheLoc in schemaCacheAtts) { LoadSchemasFromDirectory(xmlSchemaCollection, schemaCacheLoc.RelativeDirectory); } } // load schemas from explicit (user-provided) locations object[] schemaLocations = serviceType.GetCustomAttributes(typeof(ValidationSchemaAttribute), true); foreach (ValidationSchemaAttribute validationSchemaAttribute in schemaLocations) { LoadSchemaFromFile(xmlSchemaCollection, HttpContext.Current.Server.MapPath(validationSchemaAttribute.Location)); } // save schema cache for future use validationContext.SchemaCollection = xmlSchemaCollection; } // the System.Web.Services infrastructure will cache this object // and supply it in each future call to Initialize return(validationContext); }
/// <summary> /// When the SOAP extension is accessed for the first time, /// the XML Web service method store the file name passed in using the corresponding SoapExtensionAttribute. /// </summary> public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return(((AuthenticationSoapExtensionAttribute)attribute).Filename); }
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return CreateAlgorithm (); }