0

请告诉我代码状态有什么问题是 200 好的,但无法从 Web 服务接收记录(响应)它显示错误 null 请帮助我,我尝试从 2 天开始解决它...

            var webMethod = "http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit?callback=?";
             var soap ='<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  <soap:Body>     <CelsiusToFahrenheit xmlns="http://tempuri.org/"> <Celsius>12</Celsius> </CelsiusToFahrenheit>   </soap:Body> </soap:Envelope>';
            $j.ajax({
                  type: "POST",
                  url :webMethod,
                  data: soap,
                   dataType :"xml",
                  contentType:"text/xml; charset=\"utf-8\"",
                  cache:false,
                  async: false,
                error:function(resp)
                {
                    alert("Error :"+$j.parseXML(resp));
                },

            }).done(function(response){

                    console.log(response);
                    var xmlData =$j(response).find('FahrenheitToCelsiusResult').text();
                    alert(xmlData);
                }); 

        });
4

1 回答 1

0

如果您获得代码状态 200,则表示请求发送正常,并且响应从服务器发送也正常。所以,这没有问题。

作为响应,您可能会遇到什么问题?

  1. 您传递给服务器的内容是错误的(服务器无法对您的数据进行任何计算)
  2. 服务器的 Web 服务可能无法按预期工作,并为您提供空响应
于 2013-05-31T06:55:41.900 回答