Done!
Finally, it works.
I followed this tutorial and find the problem.
I need to use wsdl to generate the cs file first,
then use csc to compile the cs file to dll file,
AND, for the example in tutorial, they HAVE TO BE in bin/ directory! (OR, it will not work!)
Three importent lines:
wsdl.exe /l:CS /n:WService /out:bin/GetSuppliers.cs http://localhost/suppliers.asmx?WSDL
csc /t:library /out:bin\GetSuppliers.dll bin\GetSuppliers.cs /reference:System.dll,System.Data.dll,System.Web.dll, System.Web.Services.dll,System.XML.dll /optimize
< %@ Import Namespace="WService" % > <=no space between "<" and "%"
2004年1月31日
2004年1月30日
using ASP .NET to call web services
you'll need aspx, wsdl, cs (two files and one link)
example
using link of wsdl and command "wsdl" to generate the cs file,
use aspx to import that cs file and call the function in it.
BUT, I can't make it run YET!
try microsoft .net for binf7560
test on windows 2000
when trying to install .net sdk download
it want me to install "Microsoft Data Access Components" first. download
I think shangker will like this tutorial
I've tried following example.
------------ save this to http://192.168.111.128/DotNet/test.asmx--------------
<%@ WebService Language="c#" Class="FirstWebService" %>
using System;
using System.Web;
using System.Web.Services;
public class FirstWebService {
[WebMethod]
public string HelloWorld(string lcName) {
return "Hello World, " + lcName;
}
[WebMethod]
public decimal AddNumbers(decimal lnNumber1, decimal lnNumber2) {
return lnNumber1 + lnNumber2;
}
/*
[WebMethod]
public DateTime GetServerTime() {
return DateTime.Now;
} */
}
--------------end of test.asmx------------------
then connect to
http://192.168.111.128/DotNet/test.asmx
you can see things mentioned in this tutorial
if you want WSDL, you can connect to: http://192.168.111.128/DotNet/test.asmx?wsdl
this is the easist way to create web services I've ever seen.
this tool can help you to test it.