我正在尝试使用 jquery 从 javascript 调用 jax-ws webservice。这是我的 HTML 代码
<html>
<head>
<title>Calling Web Service from jQuery</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btnCallWebService").click(function (event) {
var soapRequest = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" xmlns:core=\"http://core.codon.com/\"><soapenv:Body><core:rectangle><length>" + "12"+ "</length><breadth>" + "10"+ "</breadth></core:rectangle></soapenv:Body></soapenv:Envelope>";
var url11 = "http://localhost:8090/area?wsdl";
$.ajax({
type: "POST",
url: url11,
contentType: "text/xml; charset=\"utf-8\"",
dataType: "xml",
data: soapRequest,
processData: false,
success: processSuccess,
error: processError
});
});
});
function processSuccess(data, status, req) {
if (status == "success")
alert(req.responseText + " @@@" + status);
$("#response").text();
}
function processError(data, status, req) {
alert(req.responseText + " " + status);
}
</script>
</head>
<body>
<h3>
Calling Web Services with jQuery/AJAX
</h3>
<input id="btnCallWebService" value="Call web service" type="button" />
<div id="response" />
</body>
</html>
此代码在 IE 中运行,并且正在以 xml 格式获得响应警报。但它不适用于 mozilla ..这段代码有什么问题。你能帮帮我吗?提前致谢