public override object GetInitializer(LogicalMethodInfo methodInfo) { LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(methodInfo.DeclaringType); object[] ats = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true); XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; return(new XmlSerializer(methodInfo.ReturnType, null, null, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace))); }
public SoapTypeStubInfo(LogicalTypeInfo logicalTypeInfo) : base(logicalTypeInfo) { xmlImporter = new XmlReflectionImporter(); soapImporter = new SoapReflectionImporter(); if (typeof(SoapHttpClientProtocol).IsAssignableFrom(Type)) { if (Bindings.Count == 0 || ((BindingInfo)Bindings[0]).WebServiceBindingAttribute == null) { throw new InvalidOperationException("WebServiceBindingAttribute is required on proxy class '" + Type + "'."); } if (Bindings.Count > 1) { throw new InvalidOperationException("Only one WebServiceBinding attribute may be specified on type '" + Type + "'."); } } object [] o = Type.GetCustomAttributes(typeof(SoapDocumentServiceAttribute), false); if (o.Length == 1) { SoapDocumentServiceAttribute a = (SoapDocumentServiceAttribute)o [0]; ParameterStyle = a.ParameterStyle; SoapBindingStyle = SoapBindingStyle.Document; } else { o = Type.GetCustomAttributes(typeof(SoapRpcServiceAttribute), false); if (o.Length == 1) { SoapRpcServiceAttribute srs = (SoapRpcServiceAttribute)o [0]; ParameterStyle = SoapParameterStyle.Wrapped; SoapBindingStyle = SoapBindingStyle.Rpc; } else { ParameterStyle = SoapParameterStyle.Wrapped; SoapBindingStyle = SoapBindingStyle.Document; } } if (ParameterStyle == SoapParameterStyle.Default) { ParameterStyle = SoapParameterStyle.Wrapped; } xmlImporter.IncludeTypes(Type); soapImporter.IncludeTypes(Type); #if MONOTOUCH SoapExtensions = new SoapExtensionRuntimeConfig [2][]; #else SoapExtensions = SoapExtension.GetTypeExtensions(Type); #endif }
public override object GetInitializer(LogicalMethodInfo methodInfo) { LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(methodInfo.DeclaringType); object[] ats = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true); XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; XmlReflectionImporter importer = new XmlReflectionImporter(); importer.IncludeTypes(methodInfo.CustomAttributeProvider); XmlTypeMapping map = importer.ImportTypeMapping(methodInfo.ReturnType, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace)); return(new XmlSerializer(map)); }
// // This needs to be thread safe // static internal LogicalTypeInfo GetLogicalTypeInfo(Type t) { lock (type_to_manager) { LogicalTypeInfo tm = (LogicalTypeInfo)type_to_manager [t]; if (tm != null) { return(tm); } tm = new LogicalTypeInfo(t); type_to_manager [t] = tm; return(tm); } }
public TypeStubInfo(LogicalTypeInfo logicalTypeInfo) { this.logicalType = logicalTypeInfo; object [] o = Type.GetCustomAttributes(typeof(WebServiceBindingAttribute), false); bool isClientSide = typeof(SoapHttpClientProtocol).IsAssignableFrom(Type); bool defaultAdded = false; string defaultBindingName = logicalType.WebServiceName + ProtocolName; if (o.Length > 0) { foreach (WebServiceBindingAttribute at in o) { AddBinding(new BindingInfo(at, defaultBindingName, LogicalType.WebServiceNamespace)); if ((at.Name == null || at.Name.Length == 0) || (at.Name == defaultBindingName)) { defaultAdded = true; } } } if (!defaultAdded && !isClientSide) { AddBindingAt(0, new BindingInfo(null, defaultBindingName, logicalType.WebServiceNamespace)); } #if NET_2_0 foreach (Type ifaceType in Type.GetInterfaces()) { o = ifaceType.GetCustomAttributes(typeof(WebServiceBindingAttribute), false); if (o.Length > 0) { defaultBindingName = ifaceType.Name + ProtocolName; foreach (WebServiceBindingAttribute at in o) { AddBinding(new BindingInfo(at, defaultBindingName, LogicalType.WebServiceNamespace)); } } } #endif }
public override object[] GetInitializers(LogicalMethodInfo[] methodInfos) { XmlReflectionImporter importer = new XmlReflectionImporter(); XmlMapping[] sers = new XmlMapping [methodInfos.Length]; for (int n = 0; n < sers.Length; n++) { LogicalMethodInfo metinfo = methodInfos[n]; if (metinfo.IsVoid) { sers[n] = null; } else { LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(metinfo.DeclaringType); object[] ats = methodInfos[n].ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true); XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; sers[n] = importer.ImportTypeMapping(methodInfos[n].ReturnType, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace)); } } return(XmlSerializer.FromMappings(sers)); }
public TypeStubInfo (LogicalTypeInfo logicalTypeInfo) { this.logicalType = logicalTypeInfo; object [] o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false); bool isClientSide = typeof (SoapHttpClientProtocol).IsAssignableFrom (Type); bool defaultAdded = false; string defaultBindingName = logicalType.WebServiceName + ProtocolName; if (o.Length > 0) foreach (WebServiceBindingAttribute at in o) { AddBinding (new BindingInfo (at, defaultBindingName, LogicalType.WebServiceNamespace)); if ((at.Name == null || at.Name.Length == 0) || (at.Name == defaultBindingName)) defaultAdded = true; } if (!defaultAdded && !isClientSide) AddBindingAt (0, new BindingInfo (null, defaultBindingName, logicalType.WebServiceNamespace)); #if NET_2_0 foreach (Type ifaceType in Type.GetInterfaces ()) { o = ifaceType.GetCustomAttributes (typeof (WebServiceBindingAttribute), false); if (o.Length > 0) { defaultBindingName = ifaceType.Name + ProtocolName; foreach (WebServiceBindingAttribute at in o) AddBinding (new BindingInfo (at, defaultBindingName, LogicalType.WebServiceNamespace)); } } #endif }
// // This needs to be thread safe // static internal LogicalTypeInfo GetLogicalTypeInfo (Type t) { lock (type_to_manager) { LogicalTypeInfo tm = (LogicalTypeInfo) type_to_manager [t]; if (tm != null) return tm; tm = new LogicalTypeInfo (t); type_to_manager [t] = tm; return tm; } }
public Soap12TypeStubInfo(LogicalTypeInfo logicalTypeInfo) : base(logicalTypeInfo) { }
public ServerType (Type type) { this.type = TypeStubManager.GetLogicalTypeInfo (type); }
public HttpSimpleTypeStubInfo(LogicalTypeInfo logicalTypeInfo) : base(logicalTypeInfo) { }
public TypeStubInfo (LogicalTypeInfo logicalTypeInfo) { this.logicalType = logicalTypeInfo; defaultBinding = logicalType.WebServiceName + ProtocolName; BindingInfo binfo = new BindingInfo (defaultBinding, logicalType.WebServiceNamespace); Bindings.Add (binfo); }
public HttpSimpleTypeStubInfo (LogicalTypeInfo logicalTypeInfo): base (logicalTypeInfo) { }
static internal TypeStubInfo GetTypeStub(Type t, string protocolName) { LogicalTypeInfo tm = GetLogicalTypeInfo(t); return(tm.GetTypeStub(protocolName)); }
public SoapTypeStubInfo (LogicalTypeInfo logicalTypeInfo) : base (logicalTypeInfo) { xmlImporter = new XmlReflectionImporter (); soapImporter = new SoapReflectionImporter (); object [] o; o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false); if (typeof (SoapHttpClientProtocol).IsAssignableFrom (Type)) { if (o.Length == 0) throw new InvalidOperationException ("WebServiceBindingAttribute is required on proxy class '" + Type + "'."); if (o.Length > 1) throw new InvalidOperationException ("Only one WebServiceBinding attribute may be specified on type '" + Type + "'."); // Remove the default binding, it is not needed since there is always // a binding attribute. Bindings.Clear (); } foreach (WebServiceBindingAttribute at in o) AddBinding (new BindingInfo (at, LogicalType.WebServiceNamespace)); o = Type.GetCustomAttributes (typeof (SoapDocumentServiceAttribute), false); if (o.Length == 1){ SoapDocumentServiceAttribute a = (SoapDocumentServiceAttribute) o [0]; ParameterStyle = a.ParameterStyle; RoutingStyle = a.RoutingStyle; Use = a.Use; SoapBindingStyle = SoapBindingStyle.Document; } else { o = Type.GetCustomAttributes (typeof (SoapRpcServiceAttribute), false); if (o.Length == 1){ SoapRpcServiceAttribute srs = (SoapRpcServiceAttribute) o [0]; ParameterStyle = SoapParameterStyle.Wrapped; RoutingStyle = srs.RoutingStyle; Use = SoapBindingUse.Encoded; SoapBindingStyle = SoapBindingStyle.Rpc; } else { ParameterStyle = SoapParameterStyle.Wrapped; RoutingStyle = SoapServiceRoutingStyle.SoapAction; Use = SoapBindingUse.Literal; SoapBindingStyle = SoapBindingStyle.Document; } } if (ParameterStyle == SoapParameterStyle.Default) ParameterStyle = SoapParameterStyle.Wrapped; if (Use == SoapBindingUse.Default) Use = SoapBindingUse.Literal; xmlImporter.IncludeTypes (Type); soapImporter.IncludeTypes (Type); SoapExtensions = SoapExtension.GetTypeExtensions (Type); }
public SoapTypeStubInfo (LogicalTypeInfo logicalTypeInfo) : base (logicalTypeInfo) { xmlImporter = new XmlReflectionImporter (); soapImporter = new SoapReflectionImporter (); if (typeof (SoapHttpClientProtocol).IsAssignableFrom (Type)) { if (Bindings.Count == 0 || ((BindingInfo)Bindings[0]).WebServiceBindingAttribute == null) throw new InvalidOperationException ("WebServiceBindingAttribute is required on proxy class '" + Type + "'."); if (Bindings.Count > 1) throw new InvalidOperationException ("Only one WebServiceBinding attribute may be specified on type '" + Type + "'."); } object [] o = Type.GetCustomAttributes (typeof (SoapDocumentServiceAttribute), false); if (o.Length == 1){ SoapDocumentServiceAttribute a = (SoapDocumentServiceAttribute) o [0]; ParameterStyle = a.ParameterStyle; SoapBindingStyle = SoapBindingStyle.Document; } else { o = Type.GetCustomAttributes (typeof (SoapRpcServiceAttribute), false); if (o.Length == 1){ ParameterStyle = SoapParameterStyle.Wrapped; SoapBindingStyle = SoapBindingStyle.Rpc; } else { ParameterStyle = SoapParameterStyle.Wrapped; SoapBindingStyle = SoapBindingStyle.Document; } } if (ParameterStyle == SoapParameterStyle.Default) ParameterStyle = SoapParameterStyle.Wrapped; xmlImporter.IncludeTypes (Type); soapImporter.IncludeTypes (Type); #if MOBILE || XAMMAC_4_5 SoapExtensions = new SoapExtensionRuntimeConfig [2][]; #else SoapExtensions = SoapExtension.GetTypeExtensions (Type); #endif }
public Soap12TypeStubInfo (LogicalTypeInfo logicalTypeInfo) : base (logicalTypeInfo) { }
public ServerType(Type type) { this.type = TypeStubManager.GetLogicalTypeInfo(type); }