Test Web Services (VFP and C#)
source

Visual FoxPro code:

CLEAR
SET MULTILOCKS ON
CLOSE DATABASES all

LOCAL loService1 AS "XML Web Service"
* LOCAL loService1 AS "MSSOAP.SoapClient30"
* Do not remove or alter following line. It is used to support IntelliSense for your XML Web service.
*__VFPWSDef__: loService1 = http://localhost/WebService1/Service1.asmx?WSDL , Service1 , Service1Soap
LOCAL loException, lcErrorMsg, loWSHandler

loWSHandler = NEWOBJECT("WSHandler",IIF(VERSION(2)=0,"",HOME()+"FFC\")+"_ws3client.vcx")
loService1 = loWSHandler.SetupClient("http://localhost/WebService1/Service1.asmx?WSDL", "Service1", "Service1Soap")
* Call your XML Web service here.  ex: leResult = loService1.SomeMethod()

SecondsBefore=SECONDS()
retVal=loService1.GetOrderdetails()
elapsed0=SECONDS()-SecondsBefore
?"loService1.GetOrderdetails():",elapsed0
?
LOCAL oXA as XMLAdapter

oXA=CREATEOBJECT("XMLAdapter")

SecondsBefore=SECONDS()
oXA.Attach(retVal.Item(1),retVal.Item(0))
elapsed1=SECONDS()-SecondsBefore
?"XMLAdapter.Attach:",elapsed1

LOCAL oCA as CursorAdapter
oCA=CREATEOBJECT("CursorAdapter")

oCA.DataSourceType="XML"
oCA.SelectCmd="oXA.TAbles.Item(1)"
oCA.Alias="OrderDetails"

SecondsBefore=SECONDS()
IF !oCA.CursorFill()
   AERROR(aerrs)
   DISPLAY MEMORY LIKE aerrs
ENDIF
elapsed2=SECONDS()-SecondsBefore
?"Fill through XMLAdapter after Attach"
?"Time:",elapsed2
?"Records:",RECCOUNT("OrderDetails")
?"XMLSize",LEN(retVal.Item(1).xml)+LEN(retVal.Item(0).xml)
?"Total time:",elapsed1+elapsed2+elapsed0

retval=null
oXA.ReleaseXML(.T.)
USE IN OrderDetails
?
SecondsBefore=SECONDS()
retval=loService1.GetOrderdetails1()
elapsed0=SECONDS()-SecondsBefore
?"loService1.GetOrderdetails1():",elapsed0
?
SecondsBefore=SECONDS()
oXA.LoadXML(retval)
elapsed1=SECONDS()-SecondsBefore
?"XMLAdapter.LoadXML:",elapsed1

SecondsBefore=SECONDS()
IF !oCA.CursorFill()
   AERROR(aerrs)
   DISPLAY MEMORY LIKE aerrs
ENDIF
elapsed2=SECONDS()-SecondsBefore
?"Fill through XMLAdapter after LoadXml"
?"Time:",elapsed2
?"Records:",RECCOUNT("OrderDetails")
?"XMLSize",LEN(retVal)
?"Total time:",elapsed1+elapsed2+elapsed0

oXA.ReleaseXML(.T.)
USE IN OrderDetails
?
oCA.SelectCmd=retval

SecondsBefore=SECONDS()
IF !oCA.CursorFill()
   AERROR(aerrs)
   DISPLAY MEMORY LIKE aerrs
ENDIF
elapsed2=SECONDS()-SecondsBefore
?"Fill through XMLTOCORSOR with schema."
?"Time:",elapsed2
?"Records:",RECCOUNT("OrderDetails")
?"XMLSize",LEN(oCA.SelectCmd)
?"Total time:",elapsed2+elapsed0
USE IN OrderDetails

?
SecondsBefore=SECONDS()
retval=loService1.GetOrderdetails2()
elapsed0=SECONDS()-SecondsBefore
?"loService1.GetOrderdetails2():",elapsed0
?
oCA.SelectCmd=retval

SecondsBefore=SECONDS()
IF !oCA.CursorFill()
   AERROR(aerrs)
   DISPLAY MEMORY LIKE aerrs
ENDIF
elapsed2=SECONDS()-SecondsBefore
?"Fill through XMLTOCORSOR without schema."
?"Time:",elapsed2
?"Records:",RECCOUNT("OrderDetails")
?"XMLSize",LEN(oCA.SelectCmd)
?"Total time:",elapsed2+elapsed0
USE IN OrderDetails
Web Service code:

private String sqlCmd=
   "SELECT * from Orderdetails"
   +" UNION ALL SELECT * from Orderdetails"
   +" UNION ALL SELECT * from Orderdetails";

[WebMethod]
public DataSet GetOrderdetails()
{
   OleDbConnection nwindConn = new OleDbConnection("Provider=VFPOLEDB.1;"+
            @"Data Source=C:\Program Files\Microsoft Visual FoxPro 8\"+
            @"Samples\Northwind\Northwind.dbc;Collating Sequence=MACHINE");

   OleDbCommand selectCMD = new OleDbCommand(sqlCmd, nwindConn);

   OleDbDataAdapter OrderdetailsDA = new OleDbDataAdapter();
   OrderdetailsDA.SelectCommand = selectCMD;

   DataSet OrderDetailsDataSet=new DataSet("OrderDetailsDataSet");
   OrderdetailsDA.Fill(OrderDetailsDataSet, "Orderdetails");

   return OrderDetailsDataSet;
}

[WebMethod]
public String GetOrderdetails1()
{
   OleDbConnection nwindConn = new OleDbConnection("Provider=VFPOLEDB.1;"+
      @"Data Source=C:\Program Files\Microsoft Visual FoxPro 8\"+
      @"Samples\Northwind\Northwind.dbc;Collating Sequence=MACHINE");

   OleDbCommand selectCMD = new OleDbCommand(sqlCmd, nwindConn);

   OleDbDataAdapter OrderdetailsDA = new OleDbDataAdapter();
   OrderdetailsDA.SelectCommand = selectCMD;

   DataSet OrderDetailsDataSet=new DataSet("OrderDetailsDataSet");
   OrderdetailsDA.Fill(OrderDetailsDataSet, "Orderdetails");

   StringWriter strXML=new StringWriter();

   OrderDetailsDataSet.WriteXml(strXML,XmlWriteMode.WriteSchema);   
   return strXML.ToString();
}

[WebMethod]
public String GetOrderdetails2()
{
   OleDbConnection nwindConn = new OleDbConnection("Provider=VFPOLEDB.1;"+
      @"Data Source=C:\Program Files\Microsoft Visual FoxPro 8\"+
      @"Samples\Northwind\Northwind.dbc;Collating Sequence=MACHINE");

   OleDbCommand selectCMD = new OleDbCommand(sqlCmd, nwindConn);

   OleDbDataAdapter OrderdetailsDA = new OleDbDataAdapter();
   OrderdetailsDA.SelectCommand = selectCMD;

   DataSet OrderDetailsDataSet=new DataSet("OrderDetailsDataSet");
   OrderdetailsDA.Fill(OrderDetailsDataSet, "Orderdetails");

   StringWriter strXML=new StringWriter();

   OrderDetailsDataSet.WriteXml(strXML,XmlWriteMode.IgnoreSchema);   
   return strXML.ToString();
}