当前位置: 代码迷 >> 综合 >> Calling WebServices using j
  详细解决方案

Calling WebServices using j

热度:60   发布时间:2023-12-17 13:10:47.0
导读:
  If you are using Microsoft IE 5 or later, you can use the behavior/HTML-Component "WebService" to access a Web service. The "WebService" behavior communicates with Web services over HTTP using Simple Object Access Protocol (SOAP).
  To use the "WebService" behavior, you must attach it to an element using the STYLE attribute, as follows:
  

STYLE="behavior:url(webservice.htc)">  STYLE="behavior:url(webservice.htc)">

  A complete example taken from the Microsoft Web site is as follows:
  
  
  <script language="j">
  var iCallID;
  function init()
  {
  service.useService
  ("http://myserver.com/services/myservice.asmx?WSDL",
  "servicename");
  }
  function onmyresult()
  {
  if ((event.result.error)&&(iCallID==event.result.id))
  {
  var xfaultcode = event.result.errorDetail.code;
  var xfaultstring = event.result.errorDetail.string;
  var xfaultsoap = event.result.errorDetail.raw;
  // Add code to output error information here
  alert("Error ");
  }
  else
  {
  service.innerHTML= "The method returned the result: "
  + event.result.value;
  }
  }
  </script>
  
  
  

  Enter a Value
  

  
  

style="behavior:url(webservice.htc)"
onresult="onmyresult();">  style="behavior:url(webservice.htc)"
  onresult="onmyresult();">
  

  
  

本文转自
http://study.qqcf.com/web/242/28052.htm
  相关解决方案