/// <summary> /// Get request schema /// </summary> /// <param name="operationDescription"></param> /// <returns></returns> public Message GetRequestXmlSchemaAsMessage(OperationDescription operationDescription) { bool isXmlSerializerType; Type body = OperationDescriptionUtilites.GetRequestBodyType(operationDescription, out isXmlSerializerType); if (IsBodySpecial(body)) { return(GetSpecialBodyDocumentationAsMessage(body, "request")); } try { return(GetXmlSchemaAsMessage(body, isXmlSerializerType)); } catch (Exception e) { return(GetTextMessage(String.Format("Could not generate schema for request. Failed with error: {0}", e.Message))); } }
/// <summary> /// Get the request example /// </summary> /// <param name="operationDescription"></param> /// <returns></returns> public Message GetRequestExampleAsMessage(OperationDescription operationDescription) { bool isXmlSerializerType; Type body = OperationDescriptionUtilites.GetRequestBodyType(operationDescription, out isXmlSerializerType); if (IsBodySpecial(body)) { return(GetSpecialBodyDocumentationAsMessage(body, "request")); } try { object instance = Activator.CreateInstance(body); return(OperationDescriptionUtilites.GetResponseFormat(operationDescription) == "Json" ? GetJsonExampleAsMessage(instance, body) : GetXmlExampleAsMessage(instance, body, isXmlSerializerType)); } catch (Exception e) { return(GetTextMessage(String.Format("Could not generate example for request. Failed with error: {0}", e.Message))); } }