Search code examples
web-servicessamsung-smart-tv

how use web services in Samsung smart tv app?


I need use web services from a Samsung Smart TV app, but this services need authentication "custom header", there is some way for use https on Samsung smart tv app?


Solution

  • The arquitecture of aplications on Samsung smart TV allow use JavaScript, and with this JQuery, so we can use AJAX for consume de Web services like this:

    $.ajax({
        url: 'url/resources/service',
        type: json.type,
        dataType: 'json',
        contentType: 'application/json',
        data:  {datos},
        beforeSend: function(jqXHR, settings){
            jqXHR.setRequestHeader("head", id);
        },
        success: function(response) {
            alert("Success");
        },
        error: function(response) {    
            alert("Error");
        }
    });
    

    But in the Web Service you need return something in the header :

    ("Access-Control-Allow-Origin", "*")
    

    Note: If you can´t modify the Web service, then this answer won't work for you! But if you can, this solves your problem.

    You don´t need implement https protocol, because the mapple browser will do it for you, then you connection is secure, y if you Web service it.