Problema com XMLHttpRequest

2 respostas
V

Pessoal,

Como faço para isso funcionar no Firefox 3.6.10:

Using the XMLHttpRequest object

Change Content

Grato,
Vinicius.

2 Respostas

douglaskd

se não tiver problema, tenta usar a biblioteca Jquery, é mais simples e mais compatível com os browsers

link: www.jquery.com

V

é que na verdade, eu estou tentando fazer isso:

Caros,

Estou querendo criar uma aplicação que acessa um web services. Para isso ouvi dizer que o HTML5 não tem nenhum suporte adicional para Web Service e preciso fazer via javascript.

Preciso então a partir de WSDL (descrição do web services) gerar um arquivo .js que me permita acessar o web services. Encontrei o APACHE CXF, que possui um bat chamado wsdl2js e executei esse comando com o meu WSDL e foi gerado um *.js qeu consegui acessar o meu serviço utilizando o browser IE, quando fui testar com o Firefox não funcionou.

Agora estou tentando descobrir o porque, consegui chegar até aqui:

A API do Apache Cxf fornece um .js que preciso importar no meu html e dentro dele há o seguinte trecho:

this.req.onreadystatechange = function() {

requester.onReadyState();

}

e está é a função:

function org_apache_cxf_client_onReadyState() {

var req = this.req;

var ready = req.readyState;

var status = req.status;
this.utils.trace("onreadystatechange " + ready);

alert("onreadystatechange1: "+ready);

alert("onreadystatechange2: "+status);
if (ready == this.READY_STATE_DONE) {

var httpStatus;

try {

httpStatus = req.status;

} catch (e) {

// Firefox throws when there was an error here.

this.utils

.trace(onreadystatechange DONE ERROR retrieving status (connection error?));

if (this.onerror != null) {

this.onerror(e);

}

return;

}

this.utils.trace("onreadystatechange DONE " + httpStatus);

if (httpStatus == 200 || httpStatus == 0) {

if (this.onsuccess != null) {

// the onSuccess function is generated, and picks apart the

// response.

if (!req.responseXML) {

if (this.parseMultipartRelated()) {

this.onsuccess(this, this.mpResponseXML);

return;

}

if (this.onerror != null) {

this.onerror(Could not handle content of response.”);

return;

}

}

this.onsuccess(this, req.responseXML);

}

} else {

this.utils.trace("onreadystatechange DONE ERROR "
  • req.getAllResponseHeaders() + " " + req.statusText + " "
  • req.responseText);
    if (this.onerror != null)
    this.onerror(this);
    }
    }
    }

Quando testo com ie, é devolvido o status 200 e dá certo.

Agora com o Firefox devolve o status 0.

Alguém pode me ajudar?

Grato,
Vinicius.

Não encontrei nada no jquery para acessar web services…

Grato.

Criado 5 de outubro de 2010
Ultima resposta 5 de out. de 2010
Respostas 2
Participantes 2