Create Application Def - Error - Cannot parse XML document - Forum - Rollbase - Progress Community

Create Application Def - Error - Cannot parse XML document

 Forum

Create Application Def - Error - Cannot parse XML document

This question is answered

Hello,

www.rollbase.com/rest/api/createApplicationDef?sessionId=123343&xmlString='<application xml below>'

When trying to perform a createApplicationDef call using the REST API service (with Administrator Privileges), I am getting an error:

<resp status="fail">
<err>Cannot parse XML document</err>
</resp>


I am using the standard Application Definition XML example provided in the documentation:

<Application id="7558" origId="7558" orderNo="3" isSystem="false" version="1"
>
<DisplayName>ABC</DisplayName>
<Props>
<pubManaged>0</pubManaged>
<helpField>false</helpField>
<isDeployed>true</isDeployed>
<dependentDefs>,</dependentDefs>
<isHidden>false</isHidden>
<useLegacyHeaderFooter>false</useLegacyHeaderFooter>
<showMenus>false</showMenus>
</Props>
<DependentDefs>USER</DependentDefs>
<DataObjectDefs>
<!-- List of Objects -->
</DataObjectDefs>
</Application>

Any suggestions on how I can fixed this error or what is wrong with my API call?

Verified Answer
  • Hi,

    Please pass  sessionId as URL parameter. It will work. Please find attached screenshot.

All Replies
  • Hi,

    createApplicationDef is REST Post API call . Please pass xml file as input  instead of xmlstring to API.

    ex:

    PostMethod post = new PostMethod(url);

    post.addRequestHeader("Accept", "text/xml");

    post.setRequestEntity("<xmlfilename");

    int result = httpclient.executeMethod(post);

    Thanks

    Satya

  • Hello Satya,

    I have exported an app as an XML using the generate XML option and I am trying to create that application again using the createApplicationDef, however now I am getting an error:

    Error processing field name: no "uiClass" attribute

  • Hi ,

    In Application xml file please check any field has attribute uiClass. if there Please change that attribute to "uiClassName".

    I am not sure why you get uiClass attribute when exported application as xml file. When i exported here getting "uiClassName" attribute.

    Thanks

    satya

  • I get uiClassName attribute as well when I export application as an xml file but when I run the api call, it gives me the error that there is no uiClass attribute which is correct. What does the createApplicationDef expect?

  • Can you please share application xml file. So that i can look into what value is getting for uiClassName attribute.

    Ex: In my case i am getting uiClassName for Email Field is

    <DataFieldDef id="9490" origId="5865" objDef="9483" columnName="STR5" fieldName="email" groupName="CONTACT" dataClassName="com.rb.core.data.definition.FieldString" uiClassName="com.rb.core.ui.web.field.EmailInput" isRequired="false" isReadOnly="false" isTextIndexable="false" isSystem="false" isAuditable="false" hasPermissions="false" maxLength="50" >

    <DisplayLabel>Email Address</DisplayLabel>

    </DataFieldDef>

  • That's correct. I get the same for my email field. Likewise I get the correct uiClassName for my other fields as well but as per the error if I'm not mistaken, its looking for uiClass and not uiClassName, correct?

  • Yes. When we create Fields alone also we need to give uiClass instead of uiClassName . Please change and try it.

  • I have changed and tried it and now I'm getting an error:

    "Object Definition 1234 not found"

    <DataObjectDefs>
    <DataObjectDef id="1234" origId="1234" objDefName="iKAppObject1" isSystem="false" isAuditable="false" isViewable="false" isFlaggable="false" isDependent="false" isDeployed="true">
    <SingularName>iKAppObj1</SingularName>
    <PluralName>iKAppObj1s</PluralName>
    
    ....

    I already have the object defined in my XML and its still showing this error. Any suggestions why?

    I also realized that the API is creating applications as and when I call the createApplicationDef API even if it has errors. Is there a way I could stop it from creating applications if there are errors because its difficult to keep undeploying and deleting them (as it requires an hour between the two actions)? KIndly let me know.

    Cheers.

  • Hi,

    By using  "install"  REST API also we can install application xml files.   It will install successfully . No modifications needed.

    Thanks

    Satya

  • Is there a function called "install" in REST API that would do this? Could you provide me with a reference, link or an example please?

    Cheers.

  • Here is documenation link for install API. Please pass xml file as body for POST Method.

    documentation.progress.com/.../Rollbase

    Thanks

    Satya

  • Hello satya,

    I am trying to do what you suggested, now I am getting some other error. I am using an Application called: SOAPUI to test the API call and am attaching a screenshot of the result that I am getting back from the request.

    Any suggestions on where I am going wrong now?

    Cheers.

  • Hi,

    Please pass  sessionId as URL parameter. It will work. Please find attached screenshot.

  • Amazing. That works brilliantly! Thanks.