![]() |
Design of web service for Excel consumption
Hi
I am trying to create a web service method that can be used to import data into Excel. From what I have read I need the web service to return a strongly typed dataset which Excel should be able to read using the XML import options. I have added a dataset definition (xsd) to my web service. I am populating the dataset with a couple of rows of test data as shown below: [WebMethod] public DataSet1 GridGetDataSet() { DataSet1 ds = new DataSet1(); ds.Table1.Rows.Add(new object[] { "Field1", 100 }); ds.Table1.Rows.Add(new object[] { "Field2", 200 }); return ds; } When I try to attach to this method using the url: http://localhost:49436/InvestigatorS...GridGetDataSet I get the following error meassge in Excel: "Microsoft Office Excel cannot access the file 'http://localhost:49436/InvestigatorService.asmx/GridGetDataSet'. There are several possible reasons: * The file name or path does not exist. * The file is being used by another program. *The workbook you are trying to save has the same name as a currently opent workbook. I am guessing that I need to do something more to the dataset definition?? BTW: Testing the method call on the web service works and returns the following xml: <?xml version="1.0" encoding="utf-8" ? - <DataSet1 xmlns="http://www.it-workplace.co.uk/" - <xs:schema id="DataSet1" targetNamespace="http://tempuri.org/DataSet1.xsd" xmlns:mstns="http://tempuri.org/DataSet1.xsd" xmlns="http://tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified" - <xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" - <xs:complexType - <xs:choice minOccurs="0" maxOccurs="unbounded" - <xs:element name="Table1" - <xs:complexType - <xs:sequence <xs:element name="Column1" type="xs:string" minOccurs="0" / <xs:element name="Column2" type="xs:double" minOccurs="0" / </xs:sequence </xs:complexType </xs:element </xs:choice </xs:complexType </xs:element </xs:schema - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" - <DataSet1 xmlns="http://tempuri.org/DataSet1.xsd" - <Table1 diffgr:id="Table11" msdata:rowOrder="0" diffgr:hasChanges="inserted" <Column1Field1</Column1 <Column2100</Column2 </Table1 - <Table1 diffgr:id="Table12" msdata:rowOrder="1" diffgr:hasChanges="inserted" <Column1Field2</Column1 <Column2200</Column2 </Table1 </DataSet1 </diffgr:diffgram </DataSet1 |
All times are GMT +1. The time now is 11:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com