<configuration>
<system.web>
<compilation
defaultLanguage="vb"
debug="true"
/>
<httpModules>
<add name="GatewayController" type="FlashGateway.Controller.GatewayController,flashgateway" />
</httpModules>
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
</system.web>
</configuration>
主要是<httpModules>
Imports System
Imports System.Data
Imports System.Web.Services
Public Class test : Inherits WebService
<WebMethod()> Public Function Getit() As String
Return "123"
End Function
End Class
stop();
//-------------------------------------------------------------
import mx.remoting.Service;
import mx.rpc.FaultEvent;
import mx.remoting.PendingCall;
import mx.rpc.ResultEvent;
import mx.rpc.RelayResponder;
mx.remoting.debug.NetDebug.initialize();
var myService:Service = new Service("http://localhost/tester/gateway.aspx", null, "http://localhost/tester/test.asmx?wsdl", null, null);
var pc:PendingCall = myService.Getit();
pc.responder = new RelayResponder(this, "Getit_Result", "Getit_Fault");
trace("这时,信息还未返回");
function Getit_Result(re:ResultEvent):Void {
trace(re.result);
}
function Getit_Fault(fe:FaultEvent):Void {
trace("接收到错误");
}
*/
//第二個方法: 利到flashgateway.dll ,通過test.asmx?wsdl 在bin創建一test.dll(沒有namespace)及test.cs再調用其test.dll的Getit方法
stop();
import mx.data.components.RemotingConnector;
mx.remoting.debug.NetDebug.initialize();
var my_rc:RemotingConnector = new RemotingConnector();
my_rc.addEventListener("result", Getit_Result);
my_rc.addEventListener("status", Getit_Status);
my_rc.gatewayUrl = "http://localhost/tester/gateway.aspx";
my_rc.methodName = "Getit";
my_rc.serviceName = "http://localhost/tester/test.asmx?wsdl";
my_rc.suppressInvalidCalls = true;
function init():Void {
if (this.inited != undefined) {
return;
} else {
var inited:Boolean = true;
my_rc.params = null;
my_rc.trigger();
}
}
init();
function Getit_Result(ev:Object) {
trace(ev.target.results) ;}
function Getit_Status(stat:Object) {
trace("接收到错误");
}
/*
stop();
import mx.remoting.Service;
import mx.rpc.FaultEvent;
import mx.remoting.PendingCall;
import mx.rpc.ResultEvent;
import mx.rpc.RelayResponder;
mx.remoting.debug.NetDebug.initialize();
var myService:Service = new Service("http://localhost/tester/gateway.aspx", null, "testvb.test", null, null);
var pc:PendingCall = myService.Getit();
pc.responder = new RelayResponder(this, "Getit_Result", "Getit_Fault");
trace("这时,信息还未返回");
function Getit_Result(re:ResultEvent):Void {
trace(re.result);
}
function Getit_Fault(fe:FaultEvent):Void {
trace("接收到错误");
}
*/
imports System.Web
imports System.Web.Services
imports System.Web.Services.Protocols
imports System.Data
imports System.Data.OleDb
Public Class con2mdb
<WebMethod()> public Function GetData() As DataSet
Dim oConn As OleDbConnection
Dim oComm As OleDbCommand
Dim oData As OleDbDataAdapter
Dim resultSet As New DataSet
Dim oConnect, oQuery As String
oConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Inetpub\\wwwroot\\tester\test.mdb"
oQuery = "SELECT * FROM main"
oConn = New OleDbConnection(oConnect)
oComm = New OleDbCommand(oQuery, oConn)
oData = New OleDbDataAdapter(oQuery, oConn)
oConn.Open()
oData.Fill(resultSet, "accessTest")
oConn.Close()
Return resultSet
End Function
End Class
import mx.data.components.RemotingConnector;
import mx.remoting.Service;
import mx.rpc.FaultEvent;
import mx.remoting.PendingCall;
import mx.rpc.ResultEvent;
import mx.rpc.RelayResponder;
mx.remoting.debug.NetDebug.initialize();
my_rc.addEventListener("result", GetData_Result);
my_rc.addEventListener("status", GetData_Status);
function init():Void {
if (this.inited != undefined) {
return;
} else {
var inited:Boolean = true;
my_rc.params = null;
my_rc.trigger();
}
}
init();
function GetData_Result(re:ResultEvent):Void {
trace("連接成功");
}
function GetData_Fault(fe:FaultEvent):Void {
trace("接收到错误");
}