Webservicedemo. asmx
Public class servicedemo: WebService
{
[Webmethod]
Public String helloworld (string SS)
{
Return "Hello World," + SS;
}
[Webmethod]
Public dataset getstudents ()
{
Datatable dt = new datatable ();
DT. Columns. Add ("FID", typeof (string ));
DT. Columns. Add ("fname", typeof (string ));
Datarow DR = DT. newrow ();
Dr ["FID"] = "123 ";
Dr ["fname"] = "wengmj ";
DT. Rows. Add (DR );
Datarow DR1 = DT. newrow ();
DR1 ["FID"] = "456 ";
DR1 ["fname"] = "CQM ";
DT. Rows. Add (DR1 );
Dataset DS = new dataset ();
DS. Tables. Add (DT );
Return Ds;
}
}
Test. asp
<%
Set objsoapclient = server. Createobject ("mssoap. soapclient30 ")
Objsoapclient. clientproperty ("serverhttprequest") = true
Call objsoapclient. mssoapinit ("http: // localhost/fredoc. Web/servicedemo. asmx? WSDL ")
Res = objsoapclient. helloworld ("wengmj ")
Set stud = objsoapclient. getstudents ()
Set xmldoc = Createobject ("msxml2.domdocument. 4.0 ")
Xmldoc. loadxml (stud. Item (1). XML)
For each node in xmldoc. firstchild. firstchild. childnodes
For each inode in node. childnodes
Response. Write inode. Text & "& nbsp ;"
Next
Response. Write "<br>"
Next
%>