[Mono-list] Web Services and DataSet
Lluis Sanchez
lluis@ximian.com
Tue, 09 Mar 2004 11:13:00 +0100
Can you please file a bug report in bugzila.ximian.com for this?
Thanks!
Lluis.
On dc, 2004-03-03 at 01:26, Alessandro Galassi wrote:
> Hi,
> I write a web Service with mono 0.29 and mon_mono 0.6 that return
> a DataSet via a Odbc connection from MySQL and work fine.
>
> Now I wont comsume the service and I write this test:
> ---------------------------------------------------------------------
> 1 : using System;
> 2 : using System.Data;
> 3 : public class DataSetTest
> 4 : {
> 5 : static void Main(string[] args)
> 6 : {
> 7 : DataSet ds = new DataSet();
> 8 : AuslWebServices ws = new AuslWebServices();
> 9 : ds.Merge(ws.AuslDataSet("select * from generale"));
> 10: ds.WriteXml("generale.xml");
> 11: }
> 12: }
> ----------------------------------------------------------------------
> I compile it with:
>
> $ wsdl AuslWebServices.wsdl
> WSDL proxy generator v0.1
> Fetching AuslWebServices.wsdl
> Writing file 'AuslWebServices.cs'
> $ mcs -t:library AuslWebServices.cs
> Compilation succeeded
> $ mcs -r:AuslWebServices.dll -r:System.Data DataSetTest.cs
>
> DataSetTest.cs(9) error CS1502: The best overloaded match for method
> 'void System.Data.DataSet.Merge (System.Data.DataRow[])' has some
> invalid arguments
> DataSetTest.cs(9) error CS1503: Argument 0: Cannot convert from 'object'
> to 'System.Data.DataRow[]'
> DataSetTest.cs(9) error CS1501: No overload for method `Merge' takes `1'
> arguments
> DataSetTest.cs(9) error CS8006: Could not find any applicable function
> for this argument list
> Compilation failed: 4 error(s), 0 warnings
>
>
> So in the AuslWebService.cs the return value of .AuslDataSet() is
> 'object' not DataSet:
> ------------------------------------------------------------------------
>
> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AuslDataSet",RequestNamespace="http://tempuri.org/",ResponseNamespace="http://tempuri.org/",ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped,Use=System.Web.Services.Description.SoapBindingUse.Literal)]
> public virtual object AuslDataSet(string query) {
> System.Object[] results = this.Invoke("AuslDataSet", new
> object[] {
> query});
> return ((object)(results[0]));
> }
>
> public virtual System.IAsyncResult BeginAuslDataSet(string query,
> System.AsyncCallback callback, object asyncState) {
> return this.BeginInvoke("AuslDataSet", new object[] {
> query}, callback, asyncState);
> }
>
> public virtual object EndAuslDataSet(System.IAsyncResult
> asyncResult) {
> System.Object[] results = this.EndInvoke(asyncResult);
> return ((object)(results[0]));
> }
> ------------------------------------------------------------------------
>
> if I cast (DataSet) in line 9 the source compile but at runtime;
>
> $ mono DataSetTest.exe
>
> Unhandled Exception: System.InvalidCastException: Cannot cast from
> source type to destination type
> in <0x00084> .DataSetTest:Main (string[])
>
> Please help me!
> Alessandro
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list