I have a WebService which returns a List of RunningReport class
How do I read this XML data on the client side. How do I convert
List<RunningRep ortfrom the WebService side to List<RunningRep orton the
client side
I have tried the following:
List<RunningRep ortreportList = null;
localhost.Repor tService localrs = new localhost.Repor tService();
localrs.Url = GetServiceURL() ;
reportList = localrs.Running Reports();
but I am getting the following error
Error 67 Cannot implicitly convert type 'localhost.Runn ingReport[]' to
'System.Collect ions.Generic.Li st<Reports.Modu les.RunningJobs .RunningReport>
Thank You
Peter
//////////////// Heres' the XML data from the WebService
///////////////////////////////////
<?xml version="1.0" encoding="utf-8" ?>
ArrayOfRunningR eport xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns="http://wsinc.com/webservices/">
<RunningRepor t>
<ReportID>0</ReportID>
<CreatedBy>12 </CreatedBy>
<ItemId>1</ItemId>
<OutputType>PDF </OutputType>
</RunningReport>
<RunningRepor t>
<ReportID>0</ReportID>
<CreatedBy>12 </CreatedBy>
<ItemId>2</ItemId>
<OutputType>PDF </OutputType>
</RunningReport>
</ArrayOfRunningR eport>
///////////////////////////////////// Here's the class that the Webservice
is returning: ////////////////////////////////////////////
using System;
using System.Collecti ons.Generic;
using System.Linq;
using System.Text;
namespace ReportInfoLib
{
[Serializable]
public class RunningReport
{
private string _reportName;
private int _reportID;
private int _createdBy;
private string _discription;
private int _itemId;
private DocumentTypeEnu m _outputType;
private string _printerName;
private string _trayName;
private string _emailList;
private List<ParameterN ameValue_pnv;
public string ReportName
{
get { return this._reportNam e; }
set { this._reportNam e = value; }
}
public int ReportID
{
get { return this._reportID; }
set { this._reportID = value; }
}
public int CreatedBy
{
get { return this._createdBy ; }
set { this._createdBy = value; }
}
public string Discription
{
get { return this._discripti on; }
set { this._discripti on = value; }
}
public int ItemId
{
get { return this._itemId; }
set { this._itemId = value; }
}
public ReportInfoLib.D ocumentTypeEnum OutputType
{
get { return this._outputTyp e; }
set { this._outputTyp e = value; }
}
public string PrinterName
{
get { return this._printerNa me; }
set { this._printerNa me = value; }
}
public string TrayName
{
get { return this._trayName; }
set { this._trayName = value; }
}
public string EmailList
{
get { return this._emailList ; }
set { this._emailList = value; }
}
public
System.Collecti ons.Generic.Lis t<ReportInfoLib .ParameterNameV aluePnv
{
get { return this._pnv; }
set { this._pnv = value; }
}
}
}
How do I read this XML data on the client side. How do I convert
List<RunningRep ortfrom the WebService side to List<RunningRep orton the
client side
I have tried the following:
List<RunningRep ortreportList = null;
localhost.Repor tService localrs = new localhost.Repor tService();
localrs.Url = GetServiceURL() ;
reportList = localrs.Running Reports();
but I am getting the following error
Error 67 Cannot implicitly convert type 'localhost.Runn ingReport[]' to
'System.Collect ions.Generic.Li st<Reports.Modu les.RunningJobs .RunningReport>
Thank You
Peter
//////////////// Heres' the XML data from the WebService
///////////////////////////////////
<?xml version="1.0" encoding="utf-8" ?>
ArrayOfRunningR eport xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns="http://wsinc.com/webservices/">
<RunningRepor t>
<ReportID>0</ReportID>
<CreatedBy>12 </CreatedBy>
<ItemId>1</ItemId>
<OutputType>PDF </OutputType>
</RunningReport>
<RunningRepor t>
<ReportID>0</ReportID>
<CreatedBy>12 </CreatedBy>
<ItemId>2</ItemId>
<OutputType>PDF </OutputType>
</RunningReport>
</ArrayOfRunningR eport>
///////////////////////////////////// Here's the class that the Webservice
is returning: ////////////////////////////////////////////
using System;
using System.Collecti ons.Generic;
using System.Linq;
using System.Text;
namespace ReportInfoLib
{
[Serializable]
public class RunningReport
{
private string _reportName;
private int _reportID;
private int _createdBy;
private string _discription;
private int _itemId;
private DocumentTypeEnu m _outputType;
private string _printerName;
private string _trayName;
private string _emailList;
private List<ParameterN ameValue_pnv;
public string ReportName
{
get { return this._reportNam e; }
set { this._reportNam e = value; }
}
public int ReportID
{
get { return this._reportID; }
set { this._reportID = value; }
}
public int CreatedBy
{
get { return this._createdBy ; }
set { this._createdBy = value; }
}
public string Discription
{
get { return this._discripti on; }
set { this._discripti on = value; }
}
public int ItemId
{
get { return this._itemId; }
set { this._itemId = value; }
}
public ReportInfoLib.D ocumentTypeEnum OutputType
{
get { return this._outputTyp e; }
set { this._outputTyp e = value; }
}
public string PrinterName
{
get { return this._printerNa me; }
set { this._printerNa me = value; }
}
public string TrayName
{
get { return this._trayName; }
set { this._trayName = value; }
}
public string EmailList
{
get { return this._emailList ; }
set { this._emailList = value; }
}
public
System.Collecti ons.Generic.Lis t<ReportInfoLib .ParameterNameV aluePnv
{
get { return this._pnv; }
set { this._pnv = value; }
}
}
}
Comment