locked
Bug in html client on updating/deleting entites with special chars (äöü) RRS feed

  • Question

  • Hi there!

    Some days ago, I have started out to transfer a ls silverlight app to html, and must admit, that it is just great! Very powerful and extensible, if there just wouldn't be any bugs. :)

    I have some trouble with the ls html client (VS2013 March Update / Update 2), when I try to delete or update entities of the entity type "Aktivitätsergebnis".

    On the client side, this basically gets executed:

    screen.Aktivitätsergebnis.deleteEntity();
    myapp.commitChanges();

    In turn, I receive this message from my odata backend:

    {"odata.error":{"code":"1","message":{"lang":"de-DE","value":"
    <?xml version=\"1.0\" encoding=\"utf-16\"?><ExceptionInfo><Message>
    Die Ressource f\u00fcr das Segment 'Aktivit' wurde nicht gefunden.</Message>
    <StackTrace> bei System.Data.Services.DataService`1.BatchDataService.
    HandleBatchContent(Stream responseStream)</StackTrace></ExceptionInfo>"}}}

    It seems that the name of the entity type is not encoded in the request:

    POST http://localhost:1861/ApplicationData.svc/$batch HTTP/1.1 DataServiceVersion: 1.0 Accept: multipart/mixed Content-Type: multipart/mixed;boundary=batch_91b1-d131-2683 MaxDataServiceVersion: 3.0 Referer: http://localhost:1861/MobileClient/ ... --batch_91b1-d131-2683 Content-Type: multipart/mixed; boundary=changeset_7c73-f74f-706a --changeset_7c73-f74f-706a Content-Type: application/http Content-Transfer-Encoding: binary MERGE Aktivitätstypen(1) HTTP/1.1 Content-ID: 0 DataServiceVersion: 3.0 If-Match: W/"X'000000000000C351'" Prefer: return-content Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1 Content-Type: application/json;odata=verbose MaxDataServiceVersion: 3.0
    ...

    In an other type of request (POST), the entity type name is encoded:

    POST http://localhost:1861/ApplicationData.svc/$batch HTTP/1.1...
    
    
    --batch_221f-94df-d37e
    Content-Type: multipart/mixed; boundary=changeset_1d54-787e-13af
    
    --changeset_1d54-787e-13af
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    
    POST Aktivit%C3%A4tstypen HTTP/1.1
    Content-ID: 0
    DataServiceVersion: 3.0
    Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1
    Content-Type: application/json;odata=verbose
    MaxDataServiceVersion: 3.0
    
    {"Bezeichnung":"Test","Planbar":true,"Aufgabe":true,"Termin":true,"Abrechenbar":false,"Stundensatz":"150","Aktiv":true}
    --changeset_1d54-787e-13af--
    
    --batch_221f-94df-d37e--

    I have already watched out for any missing pieces in msls...js, but this is little too much for me, I think.... :)

    It feels as if there would be no other way right now, is to rename the plural name of my entities. Does anybody have an idea for my case?

    Thanks a lot!

    - Andreas


    Wednesday, June 25, 2014 4:40 PM

Answers

  • On the client side, this basically gets executed:

    screen.Aktivitätsergebnis.deleteEntity();
    myapp.commitChanges();

    You may find this helpful:

    The following code snippet shows you how to implement a delete command, including appropriate error handling using promise objects:

    myapp.ViewCustomer.Delete_execute = function (screen) {   
        screen.Customer.deleteEntity();
        return myapp.commitChanges().then(null, function fail(e) {
            myapp.cancelChanges();
            throw e;
        });
    };

    Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Angie Xu Monday, July 7, 2014 8:18 AM
    Monday, June 30, 2014 11:26 AM
  • Hi,

    You should not use special chars in a table.

    Rename the "ä" to a.

    Good luck


    Sven Elm

    • Marked as answer by Angie Xu Monday, July 7, 2014 8:18 AM
    Monday, June 30, 2014 4:30 PM

All replies

  • On the client side, this basically gets executed:

    screen.Aktivitätsergebnis.deleteEntity();
    myapp.commitChanges();

    You may find this helpful:

    The following code snippet shows you how to implement a delete command, including appropriate error handling using promise objects:

    myapp.ViewCustomer.Delete_execute = function (screen) {   
        screen.Customer.deleteEntity();
        return myapp.commitChanges().then(null, function fail(e) {
            myapp.cancelChanges();
            throw e;
        });
    };

    Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Angie Xu Monday, July 7, 2014 8:18 AM
    Monday, June 30, 2014 11:26 AM
  • Hi,

    You should not use special chars in a table.

    Rename the "ä" to a.

    Good luck


    Sven Elm

    • Marked as answer by Angie Xu Monday, July 7, 2014 8:18 AM
    Monday, June 30, 2014 4:30 PM
  • Hi Angie

    Thanks a lot! That makes the error handling a lot better, although it does not solve my öüä problem.

    As a workaround, I have renamed the plural names of my entities to avoid these "special" chars. That worked without breaking any javascript code.

    @Sven: Yes, you are propably right. The encoding stuff is so annoying... But it is just so much nicer to give the objects their proper german name.

    Tuesday, July 1, 2014 12:20 PM