从javascript发布web服务

从javascript发布web服务,javascript,web-services,rest,web,Javascript,Web Services,Rest,Web,我正在尝试从javascript发布Web服务。我正在使用测试Web服务发布。但如果我查看firebug,我会得到以下例外: XML parsing error: syntax error Location: moz-nullprincipal:{9e8dc1d9-98d5-48f5-9106-5a19cb9ca7aa} Column: 1, Row: 1: Reload the page to get source for: http://www.w3schools.com/webservi

我正在尝试从javascript发布Web服务。我正在使用测试Web服务发布。但如果我查看firebug,我会得到以下例外:

XML parsing error: syntax error Location: moz-nullprincipal:{9e8dc1d9-98d5-48f5-9106-5a19cb9ca7aa} Column: 1, Row: 1:

Reload the page to get source for: http://www.w3schools.com/webservices/tempconv...
^
我的代码如下所示:

   var xmlhttp = new XMLHttpRequest();
        xmlhttp.open('POST', 'http://www.w3schools.com/webservices/tempconvert.asmx',   true);

        // build SOAP request
        var sr =
            '<soapenv:Envelope' + 
                'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
                'xmlns:api="http://127.0.0.1/Integrics/Enswitch/API" ' +
                'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
                'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' +
                '<soapenv:Body>' +
                    '<CelsiusToFahrenheit    xmlns="http://tempuri.org/">' +
                    '<Celsius>44</Celsius>' +
                    '</CelsiusToFahrenheit>'+
                '</soapenv:Body>' +
            '</soapenv:Envelope>';

        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {

                    alert('done use firebug to see response');
                }
            }
        }
        // Send the POST request
        xmlhttp.setRequestHeader('Content-Type', 'text/xml');
        xmlhttp.send(sr);
        // send request
        // ...
var xmlhttp=new XMLHttpRequest();
xmlhttp.open('POST','http://www.w3schools.com/webservices/tempconvert.asmx",对),;
//生成SOAP请求
var sr=
'' +
'' +
'' +
'44' +
''+
'' +
'';
xmlhttp.onreadystatechange=函数(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
警报(“使用firebug查看响应完成”);
}
}
}
//发送POST请求
setRequestHeader('Content-Type','text/xml');
xmlhttp.send(sr);
//发送请求
// ...
你知道吗?

我发现了问题

我在soapenv附近留出了空间。 现在看起来是这样的:

   '<soapenv:Envelope' + ' ' +
                'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
                'xmlns:api="http://127.0.0.1/Integrics/Enswitch/API" ' +
                'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
                'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' +
                '<soapenv:Body>' +
                    '<CelsiusToFahrenheit xmlns="http://tempuri.org/">' +
                    '<Celsius>44</Celsius>' +
                    '</CelsiusToFahrenheit>'+
                '</soapenv:Body>' +
            '</soapenv:Envelope>';
“”+
'' +
'' +
'44' +
''+
'' +
'';