Microsoft.ServiceModel.Web.HelpPageInvoker.GetRequestExample C# (CSharp) Method

GetRequestExample() public method

public GetRequestExample ( string operation ) : Message
operation string
return Message
        public Message GetRequestExample(string operation)
        {
            foreach (OperationDescription od in this.Description.Operations)
            {
                if (od.Name == operation)
                {
                    bool isXmlSerializerType;
                    Type body = GetRequestBodyType(od, out isXmlSerializerType);
                    Message result;
                    if (IsBodySpecial(body, "request", out result))
                    {
                        return result;
                    }

                    WebInvokeAttribute invoke = od.Behaviors.Find<WebInvokeAttribute>();
                    bool generateJson = false;
                    if (GetResponseFormat(null, invoke, od) == "Json")
                    {
                        generateJson = true;
                    }
                    try
                    {
                        return CreateExample(body, od, generateJson);
                    }
                    catch (Exception e)
                    {
                        return CreateTextMessage(String.Format("Could not generate example for request. Failed with error: {0}", e.Message));
                    }
                }
            }
            return null;
        }