public IsValidReturnValue ( System.ServiceModel.Description.MessagePartDescription part ) : bool | ||
part | System.ServiceModel.Description.MessagePartDescription | |
return | bool |
private static MessagePartDescription GetStreamPart(MessageDescription messageDescription) { if (OperationFormatter.IsValidReturnValue(messageDescription.Body.ReturnValue)) { if ((messageDescription.Body.Parts.Count == 0) && (messageDescription.Body.ReturnValue.Type == typeof(Stream))) { return(messageDescription.Body.ReturnValue); } } else if ((messageDescription.Body.Parts.Count == 1) && (messageDescription.Body.Parts[0].Type == typeof(Stream))) { return(messageDescription.Body.Parts[0]); } return(null); }
private MessageInfo CreateMessageInfo(DataContractFormatAttribute dataContractFormatAttribute, MessageDescription messageDescription, DataContractSerializerOperationBehavior serializerFactory) { if (messageDescription.IsUntypedMessage) { return(null); } MessageInfo info = new MessageInfo(); MessageBodyDescription body = messageDescription.Body; if (body.WrapperName != null) { info.WrapperName = base.AddToDictionary(body.WrapperName); info.WrapperNamespace = base.AddToDictionary(body.WrapperNamespace); } MessagePartDescriptionCollection parts = body.Parts; info.BodyParts = new PartInfo[parts.Count]; for (int i = 0; i < parts.Count; i++) { info.BodyParts[i] = this.CreatePartInfo(parts[i], dataContractFormatAttribute.Style, serializerFactory); } if (OperationFormatter.IsValidReturnValue(messageDescription.Body.ReturnValue)) { info.ReturnPart = this.CreatePartInfo(messageDescription.Body.ReturnValue, dataContractFormatAttribute.Style, serializerFactory); } info.HeaderDescriptionTable = new OperationFormatter.MessageHeaderDescriptionTable(); info.HeaderParts = new PartInfo[messageDescription.Headers.Count]; for (int j = 0; j < messageDescription.Headers.Count; j++) { MessageHeaderDescription message = messageDescription.Headers[j]; if (message.IsUnknownHeaderCollection) { info.UnknownHeaderDescription = message; } else { this.ValidateDataContractType(message.Type); info.HeaderDescriptionTable.Add(message.Name, message.Namespace, message); } info.HeaderParts[j] = this.CreatePartInfo(message, OperationFormatStyle.Document, serializerFactory); } info.AnyHeaders = (info.UnknownHeaderDescription != null) || (info.HeaderDescriptionTable.Count > 0); return(info); }
private void SerializeBody(XmlDictionaryWriter writer, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, object returnValue, object[] parameters) { if (serializer != null) { bool flag = OperationFormatter.IsValidReturnValue(returnPart); object[] o = new object[bodyParts.Count + (flag ? 1 : 0)]; int num = 0; if (flag) { o[num++] = returnValue; } for (int i = 0; i < bodyParts.Count; i++) { o[num++] = parameters[bodyParts[i].Index]; } string encodingStyle = this.isEncoded ? GetEncoding(version.Envelope) : null; serializer.Serialize(writer, o, null, encodingStyle); } }
private object DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, object[] parameters, bool isRequest) { object obj3; try { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader")); } if (parameters == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("parameters")); } object obj2 = null; if (serializer == null) { return(null); } if (reader.NodeType == XmlNodeType.EndElement) { return(null); } object[] objArray = (object[])serializer.Deserialize(reader, this.isEncoded ? GetEncoding(version.Envelope) : null); int num = 0; if (OperationFormatter.IsValidReturnValue(returnPart)) { obj2 = objArray[num++]; } for (int i = 0; i < bodyParts.Count; i++) { parameters[bodyParts[i].Index] = objArray[num++]; } obj3 = obj2; } catch (InvalidOperationException exception) { string name = isRequest ? "SFxErrorDeserializingRequestBody" : "SFxErrorDeserializingReplyBody"; throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString(name, new object[] { base.OperationName }), exception)); } return(obj3); }