CreateProcInst : The remote server returned an error: (400) Bad Request.

Comments

1 comment

  • Avatar
    Venkat A

    Hi Prakash,

    Try the below code. 

    public static string CreateProcInstEx(string PID, string PIID, string PIName, string workObjectID,

            string superPIID, string initiator, string customID, IEnumerable<NameValue> attributes, bool startImmediately)

            {

                string url = $"{WebConfig.AppSettings[$"{WFConst.constAdminSettings}:{WFConst.constWorkflowUrl}"]}CreateProcInst";

     

                #region Json Object

     

                dynamic jsonRequestData = new ExpandoObject();

     

                jsonRequestData.ProcessID = PID;

                jsonRequestData.ProcessInstID = PIID;

                jsonRequestData.ProcInstName = PIName;

                jsonRequestData.WorkObjID = workObjectID;

                jsonRequestData.WorkObjInfo = "";

                jsonRequestData.SuperProcInstID = superPIID ?? "";

                jsonRequestData.Initiator = initiator;

                jsonRequestData.CustomID = customID;

                jsonRequestData.Attributes = attributes.ToArray();

                jsonRequestData.blnStartImmediately = startImmediately;

     

                #endregion

     

                string _jsonString = JsonConvert.SerializeObject(jsonRequestData);

     

    HTTPOperations ops = new HTTPOperations(domain, this.userName,password, appID, locale);

     

                string respose = ops.POSTMethod(url, _jsonString);

     

                string eventID = null;           

            }

     

    Modification: The parameter attributes should be in array, but in that code attributes are sent as string .

     

    Thanks,

    Venkat

    0
    Comment actions Permalink

Please sign in to leave a comment.