var call = {
    to : function (method, params, callback) {
        var xhr = new XMLHttpRequest({mozSystem: true});
        var options = {};
        options.ns = "http://tempuri.org";
        xhr.open("POST", "http://mobileapps.movistar.com.uy/ibus/SmartBus.svc", true);
        var soapMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"+
            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\""+options.ns+"/\">\r\n"+
            "   <soapenv:Header/>\r\n"+
            "   <soapenv:Body>\r\n"+
            "      <tem:"+method+">\r\n";
        
        if (params !== null)
        {
            for(var key in params){
                var attrName = key;
                var attrValue = params[key];
                soapMessage += "         <tem:"+attrName+">"+attrValue+"</tem:"+attrName+">\r\n";
            }
        }
            
        soapMessage +=  "      </tem:"+method+">\r\n"+
            "   </soapenv:Body>\r\n"+
            "</soapenv:Envelope>";
        xhr.setRequestHeader("Content-Type","text/xml; charset=\"utf-8\"");
        xhr.setRequestHeader("SOAPAction","http://tempuri.org/ISmartBus/"+method);
        xhr.timeout = 120000;
        xhr.ontimeout = function () { callback("failed conection"); }
        xhr.send(soapMessage);
        xhr.onreadystatechange = function () {
            if (xhr.status === 200 && xhr.readyState === 4) {
                if (callback !== null){
                    callback(xhr.response);
                }
            }
        }
        xhr.onerror = function () {
            if (callback !== null){
                callback("failed conection");
            }
        };
    }
};