0
I am trying to access the Login method of a certain webservice, but instead of returning the . Token I ask in reply, I get a pure HTML from webservice
My code js:
$.ajax({
crossDomain: "true",
//contentType: "text/xml",
//type: "POST",
url: "http://macchips.macpontoweb.com.br/wsvisita/services/comum/autenticacao/autenticacaosrv.svc?Login",
data: {
usuario: client.value,
senha: senha.value,
},
success: function(resposta){
alert(resposta.Token);
},
error: function(error){
var falha = JSON.stringify(error);
alert("Erro " + falha);
}
});
The lines type and contenttype are commented on. I believe I need them but I’m not sure
I’m trying to access the webservice via an application I’m developing
/////EDIT///////
I made some changes, now I’m getting a readyState:4, status:200, statusText:load
My changed code:
$.ajax({
type: "POST",
crossDomain: "true",
dataType: "jsonp",
contentType: "text/xml",
url: "http://macchips.macpontoweb.com.br/WSVisita/Services/Comum/Autenticacao/AutenticacaoSrv.svc",
data: {
Login: 'wellington, wellington'
},
success: function(resposta){
window.location.href="login.html";
alert(resposta);
},
error: function(jqxhr, error){
var falha = JSON.stringify(error);
alert("Erro " + falha);
}
});
2 things: 1. You are not using
java, are usingjavascript. 2. Have you seen what this HTML says? It can be useful.– Jéf Bueno
In addition to uncomment the lines change the "url" to: http://macchips.macpontoweb.com.br/wsvisita/services/comum/autenticacao/autenticacaosrv/Login
– Éderson C. do Nascimento
It didn’t work, I get an error alert with the HTML of the webservice page and status 404
– Gabriel Donato
Yes, it is the html of the webservice page
– Gabriel Donato
the link I sent you missed the extension ". svc", with it works?
– Éderson C. do Nascimento
Still not working, but now I’m getting a status 400 error, bad request
– Gabriel Donato
Was Webservice made by you? It is designed to receive requests from other domains?
– Éderson C. do Nascimento
It wasn’t made by me, but it was designed for this, so I believe you have all the necessary authorizations
– Gabriel Donato