json oData.request - Feed tag



I'm developing in SAPUI5 and making a oData.request I encounter a problem I can not solve: SAP expects the following XML:



<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:atom="http://ift.tt/r5ut6F" xmlns:d="http://ift.tt/1cVQIMf" xmlns:m="http://ift.tt/1dtZymv">
<atom:content type="application/xml">
<m:properties>
<d:Documenttype>DPD</d:Documenttype>
<d:Statusextern>RE</d:Statusextern>
<d:Documentcategorycode>1</d:Documentcategorycode>
<d:LanguageIso_Doc>EN</d:LanguageIso_Doc>
<d:Description>Prueba texto corto</d:Description>
<d:ComputerAidedDesignDrawing>TRUE</d:ComputerAidedDesignDrawing>
</m:properties>
</atom:content>
<atom:link rel="http://ift.tt/1zQ9pdZ" type="application/atom+xml;type=feed">
<m:inline>
<atom:feed>
<atom:entry>
<atom:content type="application/xml">
<m:properties>
<d:Classtype>017</d:Classtype>
<d:Classname>CLDPD</d:Classname>
</m:properties>
</atom:content>
</atom:entry>
</atom:feed>
</m:inline>
</atom:link>
</atom:entry>


I perform this oData.request, but obtain an error because the second link need to be type feed width feed tags in xml, and i can't get it:



var sServiceUrl = "/sap/opu/odata/TENR/GW_DMS_01_SRV/";
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);
sap.ui.getCore().setModel(oModel);
OData.request ({
requestUri: "http://ift.tt/1zQ9rlW",
method: "POST",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type" : "application/atom+xml",
},
data: {
Documenttype : "DPD",
Statusextern : "RE",
Documentcategorycode : "1",
LanguageIso_Doc : "EN",
Description : "Prueba desde UI5",
ComputerAidedDesignDrawing: "TRUE",
"ti_classallocations": {
__metadata: {
uri : "ti_classallocations",
},
Classtype: "017",
Classname: "CLDPD",
},
},
},
function (data, response) {

},
function(err) {
alert(err.response.body);
}
);


The resultant XML is:



<?xml version="1.0" encoding="UTF-8"?>
<a:entry xmlns:a="http://ift.tt/r5ut6F" xmlns:d="http://ift.tt/1cVQIMf" xmlns:m="http://ift.tt/1dtZymv">
<a:author>
<a:name />
</a:author>
<a:content type="application/xml">
<m:properties>
<d:Documenttype>DPD</d:Documenttype>
<d:Statusextern>RE</d:Statusextern>
<d:Documentcategorycode>1</d:Documentcategorycode>
<d:LanguageIso_Doc>EN</d:LanguageIso_Doc>
<d:Description>Prueba desde UI5</d:Description>
<d:ComputerAidedDesignDrawing>TRUE</d:ComputerAidedDesignDrawing>
</m:properties>
</a:content>
<a:link href="ti_classallocations" rel="http://ift.tt/1zQ9pdZ" type="application/atom+xml;type=entry">
<m:inline>
<a:entry>
<a:author>
<a:name />
</a:author>
<a:id>ti_classallocations</a:id>
<a:content type="application/xml">
<m:properties>
<d:Classtype>017</d:Classtype>
<d:Classname>CLDPD</d:Classname>
</m:properties>
</a:content>
</a:entry>
</m:inline>
</a:link>
</a:entry>


Someone could help me with this issue? I'm complicated with time to complete the development.


No comments:

Post a Comment