我想致电此处公开的公共Web服务: http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
我的代码有问题,因为我总是收到“错误”警报,但我不知道问题出在哪里。
这里是代码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script>
var webServiceURL = 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService';
var soapMessage =
'<?xml version="1.0" encoding="utf-8"?> \
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types"> \
<soapenv:Header/>\
<soapenv:Body>\
<urn:checkVat>\
<urn:countryCode>IT</urn:countryCode>\
<urn:vatNumber>01234567890</urn:vatNumber>\
</urn:checkVat>\
</soapenv:Body>\
</soapenv:Envelope>';
function CallService()
{
$.ajax({
url: webServiceURL,
type: "POST",
dataType: "xml",
data: soapMessage,
processData: false,
contentType: "text/xml",
success: OnSuccess,
error: OnError
});
return false;
}
function OnSuccess(data, status)
{
alert("success");
}
function OnError(request, status, error)
{
alert('error');
}
</script>
提前感谢您的答复。