/// <summary>
        /// This method performs the actual describe for the service setup. The code here provides the configuration information needed to use the docordo.com plugin.
        /// </summary>
        public DescribeServiceResponseAPI Describe(DescribeServiceRequestAPI describeServiceRequest)
        {
            System.Diagnostics.Trace.TraceInformation("@start - public DescribeServiceResponseAPI Describe(DescribeServiceRequestAPI describeServiceRequest)");

            if (describeServiceRequest == null)
            {
                throw ErrorUtils.GetWebException(HttpStatusCode.BadRequest, "DescribeServiceRequest object cannot be null.");
            }
            
            DescribeServiceInstallResponseAPI describeServiceInstallResponse = null;
            DescribeServiceActionResponseAPI describeServiceAction = null;
            DescribeServiceResponseAPI describeServiceResponse = null;
            
            System.Diagnostics.Trace.TraceInformation("// Start building the describe service response so the caller knows what they need to provide to use this service");
            describeServiceResponse = new DescribeServiceResponseAPI();
            describeServiceResponse.culture = new CultureAPI();
            describeServiceResponse.culture.country = "US";
            describeServiceResponse.culture.language = "EN";
            describeServiceResponse.culture.variant = null;

            describeServiceResponse.providesLogic = true;
            describeServiceResponse.providesIdentity = true;

            describeServiceResponse.providesDatabase = false;            
            describeServiceResponse.providesViews = false;
            describeServiceResponse.providesSocial = false;
            
            System.Diagnostics.Trace.TraceInformation("// If the user has provided these values as part of a re-submission, we can then go about configuring the rest of the service");
            describeServiceResponse.actions = new List<DescribeServiceActionResponseAPI>();

            // We have one message available under this service for creating tasks
            describeServiceAction = new DescribeServiceActionResponseAPI();
            describeServiceAction.uriPart = SERVICE_ACTION_LOGIN;
            describeServiceAction.developerName = "Login";
            describeServiceAction.developerSummary = "This action logs a user into docordo";
            describeServiceAction.isViewMessageAction = false;
            describeServiceAction.pageResponse = null;

            // Create the inputs for the task creation
            describeServiceAction.serviceInputs = new List<DescribeValueAPI>();
            describeServiceAction.serviceInputs.Add(DescribeUtils.CreateDescribeValue(ManyWhoConstants.CONTENT_TYPE_STRING, "DocordoDomain", null, true));
            describeServiceAction.serviceInputs.Add(DescribeUtils.CreateDescribeValue(ManyWhoConstants.CONTENT_TYPE_STRING, "DocordoUsername", null, true));
            describeServiceAction.serviceInputs.Add(DescribeUtils.CreateDescribeValue(ManyWhoConstants.CONTENT_TYPE_PASSWORD, "DocordoPassword", null, true));            

            // Create the outputs for the task creation
            describeServiceAction.serviceOutputs = new List<DescribeValueAPI>();
            describeServiceAction.serviceOutputs.Add(DescribeUtils.CreateDescribeValue(ManyWhoConstants.CONTENT_TYPE_BOOLEAN, "NodeId", null, false));            

            // Add the task action to the response
            describeServiceResponse.actions.Add(describeServiceAction);

            describeServiceInstallResponse = new DescribeServiceInstallResponseAPI();
            describeServiceInstallResponse.typeElements = new List<TypeElementRequestAPI>();
            
            // Assign the installation object to our main describe response
            describeServiceResponse.install = describeServiceInstallResponse;

            return describeServiceResponse;
        }
 public DescribeServiceResponseAPI Describe(DescribeServiceRequestAPI describeServiceRequest)
 {
     try
     {
         return DocordoServiceSingleton.GetInstance().Describe(describeServiceRequest);
     }
     catch (Exception exception)
     {
         throw ErrorUtils.GetWebException(HttpStatusCode.BadRequest, exception);
     }
 }
 public DescribeServiceResponseAPI Describe(DescribeServiceRequestAPI describeServiceRequest)
 {
     try
     {
         return(SalesforceServiceSingleton.GetInstance().Describe(this.GetWho(), describeServiceRequest));
     }
     catch (Exception exception)
     {
         throw BaseHttpUtils.GetWebException(HttpStatusCode.BadRequest, BaseHttpUtils.GetExceptionMessage(exception));
     }
 }
Example #4
0
        /// <summary>
        /// This method should be used to get descriptions of supported plugins.
        /// </summary>
        public DescribeServiceResponseAPI Describe(INotifier notifier, IAuthenticatedWho authenticatedWho, DescribeServiceRequestAPI describeServiceRequest)
        {
            using (var httpClient = HttpUtils.CreateHttpClient(authenticatedWho, authenticatedWho.ManyWhoTenantId.ToString(), null, HttpUtils.SYSTEM_TIMEOUT_SECONDS))
            {
                // Use the JSON formatter to create the content of the request body.
                HttpContent httpContent = new StringContent(JsonConvert.SerializeObject(describeServiceRequest));
                httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                // Construct the URL for the describe request
                string endpointUrl = describeServiceRequest.uri + "/metadata";

                // Send the describe request over to the remote service
                HttpResponseMessage httpResponseMessage = httpClient.PostAsync(endpointUrl, httpContent).Result;

                // Check the status of the response and respond appropriately
                if (httpResponseMessage.IsSuccessStatusCode)
                {
                    // Get the describe response object from the response message
                    return(JsonConvert.DeserializeObject <DescribeServiceResponseAPI>(httpResponseMessage.Content.ReadAsStringAsync().Result));
                }
                else
                {
                    throw new ServiceProblemException(new ServiceProblem(endpointUrl, httpResponseMessage, string.Empty));
                }
            }
        }