Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services Web服务,在html页面中访问?得到错误?_Web Services - Fatal编程技术网

Web services Web服务,在html页面中访问?得到错误?

Web services Web服务,在html页面中访问?得到错误?,web-services,Web Services,Web服务,访问html页面中的服务我遇到错误,这是我的代码 <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type ="text/javascript" language="JavaScript"> function InitializeService() { service.us

Web服务,访问html页面中的服务我遇到错误,这是我的代码

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type ="text/javascript"  language="JavaScript">
 function InitializeService()     
 {
    service.useService(http://www.freewebservicesx.com/GetGoldPrice.asmx?WSDL,
    "GetCurrentGoldPrice");

 }

 Function getgold()
 {
   var users="xxxxx";
   var pawd="xxx";
   service.GetCurrentGoldPrice.callService("GetCurrentGoldPrice",users,pawd);
 }

   function ShowResult()
   {
     alert(event.result.value);
   } 

 </script>

 </head>
  <body  onload="InitializeService()" id="service"  onresult="ShowResult()">
  <button onclick="getgold()">Get Age</button>
  </body>
 </html>

无标题页
函数InitializeService()
{
service.useService(http://www.freewebservicesx.com/GetGoldPrice.asmx?WSDL,
“GetCurrentGoldPrice”);
}
函数getgold()
{
var users=“xxxxx”;
var pawd=“xxx”;
service.GetCurrentGoldPrice.callService(“GetCurrentGoldPrice”,用户,pawd);
}
函数ShowResult()
{
警报(事件、结果、值);
} 
变老

我已经用JSFIDLE尝试过了。。。给你

尝试将
函数getgold()
更改为
函数getgold()

并执行以下更改

让我知道现在发生了什么


希望有帮助。

您需要在IE浏览器中启用以下属性“初始化和编写未标记为脚本安全的ActiveX控件”

从Internet Explorer,转到工具>>Internet选项>>安全选项卡,转到自定义级别。
启用“初始化并为未标记为脚本安全的ActiveX控件编写脚本”选项,然后单击“确定”。

这些选项可能很方便<代码>http://www.webreference.com/js/column97/2.html和
http://www.webpronews.com/html-client-for-web-services-using-dhtml-behavior-2004-04
。。。我仍然不清楚您是否应该使用“行为”…我得到了java srcript错误,“Microsoft JScript运行时错误:预期对象”。。。。。。。当我在asp.net中尝试此web服务时,它工作正常。我收到错误:“Microsoft JScript运行时错误:对象不支持此属性或方法”这似乎在不同的浏览器中存在不同的问题。。试试JSON吧。。。也许肥皂会有帮助。。。
function InitializeService()     
 {
    service.useService(http://www.freewebservicesx.com/GetGoldPrice.asmx?WSDL,
    "GetCurrentGoldPrice");

 }
 function InitializeService()     
 {
    service.useService('http://www.freewebservicesx.com/GetGoldPrice.asmx?WSDL',
    'GetCurrentGoldPrice');

 }