Create Application Def - Error - Cannot parse XML document

Posted by IramK on 02-Jul-2015 04:24

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?

Posted by satyanarayana sunku on 02-Jul-2015 07:23

Hi,

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

All Replies

Posted by satyanarayana sunku on 02-Jul-2015 04:35

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

Posted by IramK on 02-Jul-2015 05:03

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

Posted by satyanarayana sunku on 02-Jul-2015 06:07

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

Posted by IramK on 02-Jul-2015 06:18

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?

Posted by satyanarayana sunku on 02-Jul-2015 06:30

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>

Posted by IramK on 02-Jul-2015 06:31

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?

Posted by satyanarayana sunku on 02-Jul-2015 06:37

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

Posted by IramK on 02-Jul-2015 06:42

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.

Posted by satyanarayana sunku on 02-Jul-2015 06:43

Hi,

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

Thanks

Satya

Posted by IramK on 02-Jul-2015 06:46

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.

Posted by satyanarayana sunku on 02-Jul-2015 06:51

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

documentation.progress.com/.../Rollbase

Thanks

Satya

Posted by IramK on 02-Jul-2015 07:06

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.

Posted by satyanarayana sunku on 02-Jul-2015 07:23

Hi,

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

Posted by IramK on 02-Jul-2015 07:33

Amazing. That works brilliantly! Thanks.

This thread is closed