一、建立webservice

 

using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //如果使用设计的组件,请取消注释以下行
        //InitializeComponent();
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    [WebMethod]
    public double Calc(double r)
    {
        return 2 * r * Math.PI;
    } 
   
}

 

 

二、Flex Bulider中

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
 <![CDATA[
  private function calc():void
  {
   var l:Number;
   l=Number(radius.text)*2*Math.PI;
   grith.text=String(l);
  }
 ]]>
</mx:Script>
<mx:WebService >
  <mx:request>
   <r>{radius.text}</r>
  </mx:request>
 </mx:operation>
</mx:WebService>

 <mx:Button x="390" y="161" label="Button" click="calc();"/>
 <mx:TextInput x="213" y="161" />
 
</mx:Application>

 

相关文章:

  • 2021-08-06
  • 2021-12-29
  • 2022-12-23
  • 2022-01-24
  • 2022-01-22
  • 2022-01-12
  • 2021-08-06
猜你喜欢
  • 2021-07-03
  • 2021-12-18
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-04-24
相关资源
相似解决方案