PC Review


Reply
Thread Tools Rate Thread

Design of web service for Excel consumption

 
 
Andrew Wiles
Guest
Posts: n/a
 
      24th Nov 2009
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">
<Column1>Field1</Column1>
<Column2>100</Column2>
</Table1>
- <Table1 diffgr:id="Table12" msdata:rowOrder="1"
diffgr:hasChanges="inserted">
<Column1>Field2</Column1>
<Column2>200</Column2>
</Table1>
</DataSet1>
</diffgr:diffgram>
</DataSet1>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attempting to design database around Excel datasheet design CBartman Microsoft Access Database Table Design 6 25th Dec 2007 07:01 PM
Web Service Consumption Issue Steve Harclerode Microsoft C# .NET 5 27th Mar 2006 12:56 PM
Hardware Design Service augiedog Computer Hardware 3 28th Feb 2006 04:16 AM
How to add a service at design time =?Utf-8?B?RGVlcGFrUw==?= Microsoft Dot NET Framework 0 3rd Mar 2005 07:13 AM
Excel memory consumption macoy.mendoza@thomson.com Microsoft Excel Worksheet Functions 1 17th Jun 2004 08:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:19 AM.