XML Parser Error

When I use applyAML, I got this error.

But my AML is correct.

An error occurred while parsing EntityName. Line 8, position 67.System.Xml.XmlException: An error occurred while parsing EntityName. Line 8, position 67.

Parents
  • Hi Bryan,

    is it possible for you to post the AML you wanted to apply?

    Cheers,

    C

  • This is my AML.

    Only the first time you send will fail, the second time will succeed.
    Very strange phenomenon.

    Thank you.

    9/12/2019 5:26:48 PM :
    送簽錯誤ATEN_CFC_COMMON_SUBMIT 表單號碼:PNR-10000007 執行XML:<AML><Item type='Activity' action='EvaluateActivity'><Activity>97E694E898C749C8BADEEA6528056A63</Activity><ActivityAssignment>714CF5F6B16E46DFBE491A0074831949</ActivityAssignment><Paths><Path id='C9B4DC45575F4C1DA2D9D25A22A4517E'>Approve</Path></Paths><DelegateTo></DelegateTo><Tasks></Tasks><Variables></Variables><Authentication mode=''></Authentication><Comments></Comments><Complete>1</Complete></Item></AML>
    錯誤訊息:System.Xml.XmlException: An error occurred while parsing EntityName. Line 8, position 67.
    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.ParseEntityName()
    at System.Xml.XmlTextReaderImpl.ParseEntityReference()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
    at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
    at System.Xml.XmlDocument.Load(XmlReader reader)
    at System.Xml.XmlDocument.LoadXml(String xml)
    at Aras.IOM.Innovator.applyMethod(String methodName, String body) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\IOM.NET\Innovator.common.cs:line 137
    at aten.BaseTool.errLog(Exception e)
    at aten.ArasTool.getAssignmentByActivity(Item actItem)
    at PKG_ATEN_Add_Review_Relationship_A3_CD746629BEEB5C79.ItemMethod.methodCode()
    at PKG_ATEN_Add_Review_Relationship_A3_CD746629BEEB5C79.CLS_ATEN_Add_Review_Relationship_A3_CD746629BEEB5C79.FNCMethod(IServerConnection InnovatorServerASP, XmlDocument inDom, XmlDocument outDom)
    at Aras.IOME.Evaluator.Aras.Server.Core.IEvaluator.DoEval(CacheMethodInfo method, XmlDocument inDom, XmlDocument outDom, EventSpecificData eventSpecificData, Object eventData) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\MethodInvocation\Evaluator.cs:line 88
    at Aras.Server.Core.ApplyItemProxy.ExecuteMethod(CacheMethodInfo meth, XmlDocument inDom, XmlDocument outDom, EventSpecificData eventSpecificData, Object eventData) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 1179
    at Aras.Server.Core.ApplyItemProxy.ExecuteMethodByNameInternal(XmlDocument inDom, XmlDocument outDom, String methodName) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 962
    at Aras.Server.Core.ApplyItemProxy.ApplyMethodInternal(XmlDocument inDom, XmlDocument outDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 859
    at Aras.Server.Core.Utilities.ApplySoapAction(String soapAction, XmlDocument inDom, XmlDocument outDom, Boolean securityCheck) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\Utilities.cs:line 2531
    at Aras.Server.Core.IOMConnection.CallAction(String actionName, XmlDocument inDom, XmlDocument outDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\IOMConnection.cs:line 126
    at Aras.IOM.Innovator.applyMethod(String methodName, String body) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\IOM.NET\Innovator.common.cs:line 140
    at PKG_ATEN_Add_Review_OnActive_A3_A2749AEF22ED7F1D.ItemMethod.methodCode(OnVoteEventArgs eventData)
    at PKG_ATEN_Add_Review_OnActive_A3_A2749AEF22ED7F1D.CLS_ATEN_Add_Review_OnActive_A3_A2749AEF22ED7F1D.FNCMethod(IServerConnection InnovatorServerASP, XmlDocument inDom, OnVoteEventArgs eventData, XmlDocument outDom)
    at Aras.IOME.Evaluator.Aras.Server.Core.IEvaluator.DoEval(CacheMethodInfo method, XmlDocument inDom, XmlDocument outDom, EventSpecificData eventSpecificData, Object eventData) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\MethodInvocation\Evaluator.cs:line 88
    at Aras.Server.Core.ApplyItemProxy.ExecuteMethod(CacheMethodInfo meth, XmlDocument inDom, XmlDocument outDom, EventSpecificData eventSpecificData, Object eventData) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 1179
    at Aras.Server.Core.ApplyItemProxy.Aras.Server.Core.IApplyItem.ExecuteMethodById(String methodId, XmlDocument inDom, XmlDocument outDom, EventSpecificData eventSpecificData, Object eventData) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 288
    at Aras.Workflow.WorkflowProcessActivity.ExecuteActivityMethods(WorkflowEventArgs workflowEventArgs) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\Workflow\WorkflowProcessActivity.cs:line 620
    at Aras.Server.Core.Workflow.ExecuteActivityMethodsPromotionsAndSendEmail(WorkflowProcess workflowProcess, WorkflowEventArgs workflowEventArgs, Boolean ignoreActivityState) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\Workflow\Workflow.cs:line 3301
    at Aras.Server.Core.Workflow.EvaluateActivityInternal(XmlDocument itemDom, XmlDocument responseDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\Workflow\Workflow.cs:line 2399
    at Aras.Server.Core.ApplyItemProxy.ApplyItem(XmlDocument& inDom, AddItemImplementationAdditionalInfo additionalItemInfo, XmlDocument& outDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 736
    at Aras.Server.Core.ApplyItemProxy.Aras.Server.Core.IApplyItem.ApplyItem(XmlDocument inDom, XmlDocument outDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\ApplyItem.cs:line 268
    at Aras.Server.Core.Utilities.ApplyAML(XmlDocument amlDom, XmlDocument passedResponseDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\Utilities.cs:line 1891
    at Aras.Server.Core.Utilities.ApplySoapAction(String soapAction, XmlDocument inDom, XmlDocument outDom, Boolean securityCheck) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\Utilities.cs:line 2525
    at Aras.Server.Core.IOMConnection.CallAction(String actionName, XmlDocument inDom, XmlDocument outDom) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\Core\IOMConnection.cs:line 126
    at Aras.IOM.Innovator.applyAML(String AML) in D:\Builds\Innovator\6549-RELS11-0-SP9\Innovator.git\Innovator\CompilableCode\IOM.NET\Innovator.common.cs:line 112
    at PKG_ATEN_CFC_COMMON_SUBMIT_A7_7821F2D3EA3AD5DC.ItemMethod.methodCode()

  • Hi Bryan,

    thanks for sharing the AML. Do you have any server methods on the activity you are trying to evaluate in the AML? It seems the AML you posted isn't the problem itself, but that when the "EvaluateActivity" action tries to ExecuteActivityMethods(), you get an error.

    Cheers,

    C

Reply
  • Hi Bryan,

    thanks for sharing the AML. Do you have any server methods on the activity you are trying to evaluate in the AML? It seems the AML you posted isn't the problem itself, but that when the "EvaluateActivity" action tries to ExecuteActivityMethods(), you get an error.

    Cheers,

    C

Children
  • This is my server method.

    I sometimes get the error method.

    Please help me.

    Thank you.

    /*****************************************************************
    * Date:
    * Author:
    * MethodName:ATEN_CFC_COMMON_SUBMIT
    * Purpose:送出簽核(參數=pathName,comments,formID,signOff;
    成功回傳1,其餘任何回傳或未回傳皆為簽核失敗)
    版本20:加入判斷isCheckOverride如果為觀察者override設0
    加入代理人判斷功能 -20190315 Bryantwu
    *****************************************************************/
    //System.Diagnostics.Debugger.Break();
    Innovator innovator = this.getInnovator();
    ArasTool aras = new ArasTool(innovator);
    StringBuilder body = new StringBuilder("");
    string yyyymmdd = DateTime.Now.ToString("yyyyMMdd");
    string methodName = "ATEN_CFC_COMMON_SUBMIT";

    //接參數
    string pathName = this.getProperty("pathName");
    string comments = this.getProperty("comments");
    string formID = this.getProperty("formID");
    string signOff = this.getProperty("signOff");
    string isCheckOverride = this.getProperty("isCheckOverride");

    //取Workflow
    Item wfItem = this.newItem("Workflow","get");
    wfItem.setProperty("source_id",formID);
    wfItem = wfItem.apply();

    //取文件號碼
    string typeName = aras.getTypeNameByWorkflow(wfItem);
    Item fItem = this.newItem(typeName,"get");
    fItem.setProperty("id",formID);
    fItem = fItem.apply();
    string formNumber = fItem.getProperty("_number");

    if(wfItem.isError()){
    return innovator.newResult(wfItem.getErrorString());
    } else {

    bool isSignoffBy = false;
    //取登入者Identity ID
    string loginUser = innovator.getUserID();
    Item userIden = aras.getIdentityFromUserByID(loginUser);
    string loginUserIden = userIden.getProperty("id");
    //取Activity
    Item act = aras.getActivityByFormItem(fItem);
    //取Activity Assignment
    Item actAssigns = this.newItem("Activity Assignment","get");
    Item actAssign = this.newItem("Activity Assignment","get");
    actAssigns.setProperty("source_id",act.getID());
    actAssigns.setPropertyCondition("closed_by", "is null");
    //BRYANT
    actAssigns.setProperty("for_all_members","0");
    actAssigns = actAssigns.apply();
    string actAssignID = "";
    for(int j=0; j<actAssigns.getItemCount(); j++){
    if(isSignoffBy) break;
    //取簽核者Identity
    actAssign = actAssigns.getItemByIndex(j);
    actAssignID = actAssign.getID();

    string signoffUser = actAssign.getProperty("related_id");
    string isAlias = aras.isPersonIdentityByID(signoffUser);
    //加入代理人判斷功能 -20190315 Bryantwu
    string para="<LoginUser>"+loginUserIden+"</LoginUser><Assignment>"+signoffUser+"</Assignment><FormItemName>"+typeName+"</FormItemName>";
    string isAgent = innovator.applyMethod("ATEN_Check_Agent",para).getResult();

    //若為群組則判斷是否為成員
    if("0".Equals(isAlias)){
    string isChild = aras.isChildrenIdentityByID(signoffUser,loginUserIden);
    if("1".Equals(isChild) || isAgent.Equals("1")){
    isSignoffBy = true;
    }
    } else {
    if(signoffUser.Equals(loginUserIden) || isAgent.Equals("1")){
    isSignoffBy = true;
    }
    // //test
    // if(signoffUser.Equals(loginUserIden)){
    // isSignoffBy = true;
    // }
    }
    }//for


    if(!isSignoffBy){
    return innovator.newResult(aras.getLanguageText("flow.NotAssignment")); //您目前非簽核者!
    } else {
    if("Approve".Equals(signOff) || "Reject".Equals(signOff) || "Cancel".Equals(signOff)){
    if(String.IsNullOrEmpty(pathName)){
    pathName = signOff;
    }
    }else {
    return innovator.newResult(aras.getLanguageText("flow.SigningError")+aras.getLanguageText("flow.ErrorSignOpinion")); //簽核錯誤:簽核意見有誤
    }
    string pathID = aras.getPathIDByActivity(act, pathName);
    if(String.IsNullOrEmpty(pathID)){
    return innovator.newResult(aras.getLanguageText("flow.SigningError")+pathName+aras.getLanguageText("flow.NoPathID")+act.getID()); //簽核錯誤:XXX無法取得PathID!XXX
    } else {
    if(isCheckOverride.Equals("Y")){
    //設定Path Override狀態簽核者才需override。 簽核者:voting_weight>=1 觀察者:voting_weight=0 2018/1/15
    if(pathName=="Reject" && actAssign.getProperty("voting_weight")=="0"){
    setPath(pathName,act,"0");
    }
    else if(pathName=="Reject" && actAssign.getProperty("voting_weight")!="0"){
    setPath(pathName,act,"1");
    }
    }
    body.Append("<AML>");
    body.Append("<Item type='").Append(act.getAttribute("type")).Append("' action='EvaluateActivity'>");
    body.Append("<Activity>").Append(act.getID()).Append("</Activity>");
    body.Append("<ActivityAssignment>").Append(actAssign.getID()).Append("</ActivityAssignment>");
    body.Append("<Paths>");
    body.Append("<Path id='").Append(pathID).Append("'><![CDATA['").Append(pathName).Append("']]></Path>");
    body.Append("</Paths>");
    body.Append("<DelegateTo></DelegateTo>");
    body.Append("<Tasks></Tasks>");
    body.Append("<Variables></Variables>");
    body.Append("<Authentication mode=''></Authentication>");
    body.Append("<Comments>").Append(comments).Append("</Comments>");
    body.Append("<Complete>1</Complete>");
    body.Append("</Item></AML>");

    int count = 0;
    int maxTries = 3;
    while(true) {
    try {
    CCO.Utilities.WriteDebug("log_"+yyyymmdd, formNumber + ":Start applyAML");
    CCO.Utilities.WriteDebug("log_"+yyyymmdd, formNumber + ":XML=>" + body.ToString());
    Item res = innovator.applyAML(body.ToString());
    CCO.Utilities.WriteDebug("log_"+yyyymmdd, formNumber + ":End applyAML");
    if (res.isError()) {
    CCO.Utilities.WriteDebug("log_"+yyyymmdd, formNumber + ":" + res.getErrorString());
    return innovator.newResult(formNumber + ":" + res.getErrorString());
    } else {
    return innovator.newResult("1");
    }
    } catch (Exception e) {
    // handle exception
    if (++count == maxTries) {
    CCO.Utilities.WriteDebug("log_"+yyyymmdd,"Retry Time(" + count.ToString() + ")");
    CCO.Utilities.WriteDebug("log_"+yyyymmdd,"送簽錯誤" + methodName+" 表單號碼:"+formNumber+" 執行XML:"+body.ToString()+"\r\n錯誤訊息:"+e.ToString());
    return innovator.newError(""); //前端顯示 送簽異常-請聯絡系統管理員(Error)!! 用newError停止流程往下走
    };
    CCO.Utilities.WriteDebug("log_"+yyyymmdd,"Retry Time(" + count.ToString() + ")");
    }
    }
    }
    }
    //return innovator.newResult(formNumber + ":Error");
    }

    }

    private void setPath(string pathName,Item act,string type)
    {
    Item qry = this.newItem("Workflow Process Path","get");
    qry.setAttribute("select","id");
    qry.setProperty("source_id",act.getID());
    qry.setAttribute("orderBy", "created_on DESC");
    qry.setProperty("name",pathName);
    qry = qry.apply();
    if (qry.isError())
    {
        throw new Exception(qry.getErrorString());
    }
    Item path = qry.getItemByIndex(0);
    path.setAction("edit");
    path.setProperty("is_override",type);
    path = path.apply();

    if (path.isError())
    {
        throw new Exception(path.getErrorString());
    }