public PrimitiveOperationFormatter(OperationDescription description, bool isRpc)
{
if (description == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
}
OperationFormatter.Validate(description, isRpc, false /*isEncoded*/);
this.operation = description;
#pragma warning suppress 56506 // Microsoft, OperationDescription.Messages never be null
this.requestMessage = description.Messages[0];
if (description.Messages.Count == 2)
{
this.responseMessage = description.Messages[1];
}
int stringCount = 3 + requestMessage.Body.Parts.Count;
if (responseMessage != null)
{
stringCount += 2 + responseMessage.Body.Parts.Count;
}
XmlDictionary dictionary = new XmlDictionary(stringCount * 2);
xsiNilLocalName = dictionary.Add("nil");
xsiNilNamespace = dictionary.Add(System.Xml.Schema.XmlSchema.InstanceNamespace);
OperationFormatter.GetActions(description, dictionary, out this.action, out this.replyAction);
if (requestMessage.Body.WrapperName != null)
{
requestWrapperName = AddToDictionary(dictionary, requestMessage.Body.WrapperName);
requestWrapperNamespace = AddToDictionary(dictionary, requestMessage.Body.WrapperNamespace);
}
requestParts = AddToDictionary(dictionary, requestMessage.Body.Parts, isRpc);
if (responseMessage != null)
{
if (responseMessage.Body.WrapperName != null)
{
responseWrapperName = AddToDictionary(dictionary, responseMessage.Body.WrapperName);
responseWrapperNamespace = AddToDictionary(dictionary, responseMessage.Body.WrapperNamespace);
}
responseParts = AddToDictionary(dictionary, responseMessage.Body.Parts, isRpc);
if (responseMessage.Body.ReturnValue != null && responseMessage.Body.ReturnValue.Type != typeof(void))
{
returnPart = AddToDictionary(dictionary, responseMessage.Body.ReturnValue, isRpc);
}
}
}