public XmlSerializerOperationFormatter(OperationDescription description, XmlSerializerFormatAttribute xmlSerializerFormatAttribute, MessageInfo requestMessageInfo, MessageInfo replyMessageInfo) : base(description, xmlSerializerFormatAttribute.Style == OperationFormatStyle.Rpc, false/*isEncoded*/) { _requestMessageInfo = requestMessageInfo; _replyMessageInfo = replyMessageInfo; }
public XmlSerializerOperationBehavior(OperationDescription operation, System.ServiceModel.XmlSerializerFormatAttribute attribute) { if (operation == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); } this.reflector = new Reflector(operation.DeclaringContract.Namespace, operation.DeclaringContract.ContractType).ReflectOperation(operation, attribute ?? new System.ServiceModel.XmlSerializerFormatAttribute()); }
public XmlSerializerOperationBehavior(OperationDescription operation, XmlSerializerFormatAttribute attribute) { if (operation == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation"); #pragma warning suppress 56506 // Declaring contract cannot be null Reflector parentReflector = new Reflector(operation.DeclaringContract.Namespace, operation.DeclaringContract.ContractType); #pragma warning suppress 56506 // parentReflector cannot be null _reflector = parentReflector.ReflectOperation(operation, attribute ?? new XmlSerializerFormatAttribute()); }
public XmlSerializerOperationBehavior ( OperationDescription operation, XmlSerializerFormatAttribute format) { if (format == null) format = new XmlSerializerFormatAttribute (); this.format = format; this.operation = operation; }
public static TypedMessageConverter Create(Type messageContract, String action, String defaultNamespace, XmlSerializerFormatAttribute formatterAttribute) { if (messageContract == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("messageContract")); if (defaultNamespace == null) defaultNamespace = NamingHelper.DefaultNamespace; return new XmlMessageConverter(GetOperationFormatter(messageContract, formatterAttribute, defaultNamespace, action)); }
public XmlSerializerOperationFormatter(OperationDescription description, XmlSerializerFormatAttribute xmlSerializerFormatAttribute, MessageInfo requestMessageInfo, MessageInfo replyMessageInfo) : base(description, xmlSerializerFormatAttribute.Style == OperationFormatStyle.Rpc, xmlSerializerFormatAttribute.IsEncoded) { if (xmlSerializerFormatAttribute.IsEncoded && (xmlSerializerFormatAttribute.Style != OperationFormatStyle.Rpc)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxDocEncodedNotSupported", new object[] { description.Name }))); } this.isEncoded = xmlSerializerFormatAttribute.IsEncoded; this.requestMessageInfo = requestMessageInfo; this.replyMessageInfo = replyMessageInfo; }
public static TypedMessageConverter Create(System.Type messageContract, string action, string defaultNamespace, XmlSerializerFormatAttribute formatterAttribute) { if (messageContract == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("messageContract")); } if (defaultNamespace == null) { defaultNamespace = "http://tempuri.org/"; } return new XmlMessageConverter(GetOperationFormatter(messageContract, formatterAttribute, defaultNamespace, action)); }
public XmlMessagesFormatter (MessageDescriptionCollection messages, XmlSerializerFormatAttribute attr) : base (messages) { this.attr = attr; }
public XmlMessagesFormatter (OperationDescription desc, XmlSerializerFormatAttribute attr) : base (desc) { this.attr = attr; }
internal ExtensionData(XmlSerializerFormatAttribute xsFormatAttr) { this.xsFormatAttr = xsFormatAttr; }
internal OperationReflector(XmlSerializerOperationBehavior.Reflector parent, OperationDescription operation, XmlSerializerFormatAttribute attr, bool reflectOnDemand) { OperationFormatter.Validate(operation, attr.Style == OperationFormatStyle.Rpc, attr.IsEncoded); this.parent = parent; this.Operation = operation; this.Attribute = attr; this.IsEncoded = attr.IsEncoded; this.IsRpc = attr.Style == OperationFormatStyle.Rpc; this.IsOneWay = operation.Messages.Count == 1; this.RequestRequiresSerialization = !operation.Messages[0].IsUntypedMessage; this.ReplyRequiresSerialization = !this.IsOneWay && !operation.Messages[1].IsUntypedMessage; MethodInfo operationMethod = operation.OperationMethod; if (operationMethod == null) { this.keyBase = string.Empty; if (operation.DeclaringContract != null) { this.keyBase = operation.DeclaringContract.Name + "," + operation.DeclaringContract.Namespace + ":"; } this.keyBase = this.keyBase + operation.Name; } else { this.keyBase = operationMethod.DeclaringType.FullName + ":" + operationMethod.ToString(); } foreach (MessageDescription description in operation.Messages) { foreach (MessageHeaderDescription description2 in description.Headers) { this.SetUnknownHeaderInDescription(description2); } } if (!reflectOnDemand) { this.EnsureMessageInfos(); } }
internal static XmlSerializerOperationFormatter CreateOperationFormatter(OperationDescription operation, XmlSerializerFormatAttribute attr) { return new XmlSerializerOperationBehavior(operation, attr).CreateFormatter(); }
public static TypedMessageConverter Create(Type messageContract, string action, XmlSerializerFormatAttribute formatterAttribute) { return Create(messageContract, action, null, formatterAttribute); }
public static TypedMessageConverter Create ( Type type, string action, string defaultNamespace, XmlSerializerFormatAttribute formatterAttribute) { return new DefaultTypedMessageConverter ( new XmlMessagesFormatter ( MessageContractToMessagesDescription (type, defaultNamespace, action), formatterAttribute)); }
public static TypedMessageConverter Create ( Type type, string action, XmlSerializerFormatAttribute formatterAttribute) { return Create (type, action, TempUri, formatterAttribute); }
// overrides the auto-reflection with an attribute internal OperationReflector ReflectOperation(OperationDescription operation, XmlSerializerFormatAttribute attrOverride) { OperationReflector operationReflector = new OperationReflector(this, operation, attrOverride, true/*reflectOnDemand*/); _operationReflectors.Add(operationReflector); return operationReflector; }
internal OperationReflector(Reflector parent, OperationDescription operation, XmlSerializerFormatAttribute attr, bool reflectOnDemand) { Fx.Assert(parent != null, ""); Fx.Assert(operation != null, ""); Fx.Assert(attr != null, ""); OperationFormatter.Validate(operation, attr.Style == OperationFormatStyle.Rpc, false/*IsEncoded*/); _parent = parent; this.Operation = operation; this.Attribute = attr; this.IsRpc = (attr.Style == OperationFormatStyle.Rpc); this.IsOneWay = operation.Messages.Count == 1; this.RequestRequiresSerialization = !operation.Messages[0].IsUntypedMessage; this.ReplyRequiresSerialization = !this.IsOneWay && !operation.Messages[1].IsUntypedMessage; MethodInfo methodInfo = operation.OperationMethod; if (methodInfo == null) { // keyBase needs to be unique within the scope of the parent reflector _keyBase = string.Empty; if (operation.DeclaringContract != null) { _keyBase = operation.DeclaringContract.Name + "," + operation.DeclaringContract.Namespace + ":"; } _keyBase = _keyBase + operation.Name; } else _keyBase = methodInfo.DeclaringType.FullName + ":" + methodInfo.ToString(); foreach (MessageDescription message in operation.Messages) foreach (MessageHeaderDescription header in message.Headers) SetUnknownHeaderInDescription(header); if (!reflectOnDemand) { this.EnsureMessageInfos(); } }
internal XmlSerializerOperationBehavior(OperationDescription operation, System.ServiceModel.XmlSerializerFormatAttribute attribute, Reflector parentReflector) : this(operation, attribute) { this.reflector = parentReflector.ReflectOperation(operation, attribute ?? new System.ServiceModel.XmlSerializerFormatAttribute()); }
internal XmlSerializerOperationBehavior(OperationDescription operation, XmlSerializerFormatAttribute attribute, Reflector parentReflector) : this(operation, attribute) { // used by System.ServiceModel.Web _reflector = parentReflector.ReflectOperation(operation, attribute ?? new XmlSerializerFormatAttribute()); }
internal static XmlSerializerOperationFormatter CreateOperationFormatter(OperationDescription operation, System.ServiceModel.XmlSerializerFormatAttribute attr) { return(new XmlSerializerOperationBehavior(operation, attr).CreateFormatter()); }
internal OperationReflector ReflectOperation(OperationDescription operation, XmlSerializerFormatAttribute attrOverride) { OperationReflector item = new OperationReflector(this, operation, attrOverride, true); this.operationReflectors.Add(item); return item; }
public void Validate_Throws_If_XmlSerializerFormat_With_Rpc_Format_Style() { HttpBehavior behavior = new HttpBehavior(); ContractDescription description = ContractDescription.GetContract(typeof(CustomerService)); ServiceEndpoint endpoint = new ServiceEndpoint(description); endpoint.Binding = new HttpBinding(); endpoint.Address = new EndpointAddress("http://somehost"); OperationDescription od = description.Operations[0]; XmlSerializerFormatAttribute attr = new XmlSerializerFormatAttribute() { Style = OperationFormatStyle.Rpc }; od.Behaviors.Add(new XmlSerializerOperationBehavior(od, attr)); ExceptionAssert.Throws<InvalidOperationException>( "XmlSerializerFormat with RPC should throw", Http.SR.InvalidXmlSerializerFormatAttribute( od.Name, od.DeclaringContract.Name, typeof(XmlSerializerFormatAttribute).Name), () => behavior.Validate(endpoint)); }
public XmlSerializerOperationBehavior ( OperationDescription operation, XmlSerializerFormatAttribute format) { if (operation == null) throw new ArgumentNullException ("operation"); if (format == null) format = new XmlSerializerFormatAttribute (); this.format = format; this.operation = operation; }