issue with POST in Atom/XML format

Jul 26, 2013 at 1:26 PM
Hi guys,

I still have the issue in 1.1.0 when doing GET requests with Atom/XML and there is no embedded metadata returned by the server.

But when I want to do POST requests in atom/xml format and I create a payload in JSON structure (without metadata) and hand over the previously fetched metadata too in the request then all types will get Edm.String in the POST request
Similar to here:

Has this been fixed?
Aug 1, 2013 at 6:33 AM
Aug 14, 2013 at 8:46 AM
Edited Aug 14, 2013 at 12:49 PM

it also doesn't work with
datajs 1.1.1 stable :(

always Edm.String for all types in the post body
could this be fixed or even removed? normally the server knows its metadata...

I debugged a little bit and found out that in

var xmlNewODataDataElement = function (dom, name, value, dataItemMetadata, dataItemModel, model) {

// does not work...wrong methd???
var typeName = dataItemTypeName(value, dataItemMetadata, dataItemModel);

the function dataItemTypeName does not work correctly and doesn't consider the third dataItemModel parameter...
should another function be called instead?

what works is
var typeName = dataItemTypeName(value, dataItemModel);
dataItemMetadata is an empty object

Analyzed further:
for PUT requests it works correctly because dataItemMetadata is not empty in that case...

Sep 13, 2013 at 7:58 AM
I am having the same problem, when using Odata.request with method "POST", metadata ist not used.

I tried Odata.defaultMetadata.push(metadata) and Odata.request(request, success, error, undefined, undefined, metadata) - which both end up ignoring given metadata...

I have not yet gone into debugging data.js, but will try now...
Sep 13, 2013 at 12:13 PM
Got it to work by extending the entity with custom __metadata property.... this is not a recommended solution... but nontheless, here is my code:
function generateMetadata(entityName, fullmeta) {
    var meta = {};
    var props = {};
    meta["properties"] = props;

    if (fullmeta && fullmeta.dataServices && fullmeta.dataServices.schema && fullmeta.dataServices.schema[0] && fullmeta.dataServices.schema[0].entityType) {
        var entity = $(fullmeta.dataServices.schema[0].entityType).filter(function () {return == entityName});
        if (entity && entity.length > 0) {
            entity = entity[0];
            for (var i = 0; i <; i++) {
                if ([i].name != "__metadata")
                    props[[i].name] =[i];
    return meta;
Hope this might help someone