473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DataSets, Web Services, DiffGrams, Arrays, and Interoperability

I built the example application outlined in this artical:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnservice/html/service02112003.asp

There were a number of questions along the same lines
posted to the page's discussion forum but no one replied
with a solution.

The problem I am experiencing is with the 3rd example.

On the server you code the following web service:

[WebMethod()]
[return: XmlElement(typeof(Items[]))]
public XmlDataDocument GetTypedXmlDataDocument()
{
sqlDataAdapter1.Fill(typedDataSet1);
XmlDataDocument dataDoc
= new XmlDataDocument(typedDataSet1);
return dataDoc;
}

On the client, after adding a reference to the web service
you code:

localhost.Service1 proxy = new localhost.Service1();
localhost.Items[] items = proxy.GetTypedXmlDataDocument();
string description;
description = items[1].Description;

What the example is attempting to do is to cast the
returned XmlDataDocment xml data stream into an array of
xml elements of type Item.

The web service works when called with 'invoke' from the
automatically generated test web page. Invoke uses the
http protocol. When the web service is called using the
Soap protocol the server returns:

System.Web.Services.Protocols.SoapException: Server was
unable to process request. --->
System.InvalidOperationException: There was an error
generating the XML document. --->
System.InvalidCastException: Specified cast is not valid.
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializat
ionWriter1.Write16_Test4Response(Object[] p) [...]

Can someone point out why this error is occuring and what
the solution is?

At the end of the day this process creates a wsdl file
that is properly constructed to describe the casted return
object. How is the wsdl generated; what program\api call
is used to generate the wsdl? Is this feature accesible
to anyone other than microsoft and if so where is the
documentation?

Thanks

Mark

Nov 12 '05 #1
7 3325
Hi Mark,

I'm currently researching on this issue and will update you as soon as I
get any progress.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "Mark" <mh*@yadayada.com>
| Sender: "Mark" <mh*@yadayada.com>
| Subject: DataSets, Web Services, DiffGrams, Arrays, and Interoperability
| Date: Fri, 14 Nov 2003 14:40:40 -0800
| Lines: 63
| Message-ID: <05****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOrAFTlW/UOm46TQrmXZukqSD6BcQ==
| Newsgroups: microsoft.public.dotnet.xml
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.xml:17224
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.xml
|
| I built the example application outlined in this artical:
|
| http://msdn.microsoft.com/library/default.asp?
| url=/library/en-us/dnservice/html/service02112003.asp
|
| There were a number of questions along the same lines
| posted to the page's discussion forum but no one replied
| with a solution.
|
| The problem I am experiencing is with the 3rd example.
|
| On the server you code the following web service:
|
| [WebMethod()]
| [return: XmlElement(typeof(Items[]))]
| public XmlDataDocument GetTypedXmlDataDocument()
| {
| sqlDataAdapter1.Fill(typedDataSet1);
| XmlDataDocument dataDoc
| = new XmlDataDocument(typedDataSet1);
| return dataDoc;
| }
|
| On the client, after adding a reference to the web service
| you code:
|
| localhost.Service1 proxy = new localhost.Service1();
| localhost.Items[] items = proxy.GetTypedXmlDataDocument();
| string description;
| description = items[1].Description;
|
| What the example is attempting to do is to cast the
| returned XmlDataDocment xml data stream into an array of
| xml elements of type Item.
|
| The web service works when called with 'invoke' from the
| automatically generated test web page. Invoke uses the
| http protocol. When the web service is called using the
| Soap protocol the server returns:
|
| System.Web.Services.Protocols.SoapException: Server was
| unable to process request. --->
| System.InvalidOperationException: There was an error
| generating the XML document. --->
| System.InvalidCastException: Specified cast is not valid.
| at
| Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializat
| ionWriter1.Write16_Test4Response(Object[] p) [...]
|
| Can someone point out why this error is occuring and what
| the solution is?
|
| At the end of the day this process creates a wsdl file
| that is properly constructed to describe the casted return
| object. How is the wsdl generated; what program\api call
| is used to generate the wsdl? Is this feature accesible
| to anyone other than microsoft and if so where is the
| documentation?
|
| Thanks
|
| Mark
|
|

Nov 12 '05 #2
Hello Mark,

I am not sure of the first problem. However, for how to generate wsdl,
please refer to .NET framework tool:

Disco.exe
http://msdn.microsoft.com/library/en...ervicesDiscove
ryToolDiscoexe.asp?frame=true
The .wsdl, .xsd, .disco, and .discomap files produced by this tool can be
used as input to the Web Services Description Language Tool (Wsdl.exe) to
create XML Web service clients.

Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 12 '05 #3
Mark,
I'll try to reproduce the problem here to find the cause. I'll keep you
posted on this.

Thanks,
Syed ...
Microsoft Developer Support

Nov 12 '05 #4
I haven't heard anything on the status of this problem.
Are you still looking into it?
-----Original Message-----
Mark,
I'll try to reproduce the problem here to find the cause. I'll keep youposted on this.

Thanks,
Syed ...
Microsoft Developer Support

.

Nov 12 '05 #5
Hi Mark,

Yes, we are still investigating this issue. Unfortunately, with the
holidays here, things have slowed down a bit. I have placed a call to
check on the status of getting you a response.

Thanks for your continued patience,

Brett Keown
Microsoft Support
br*****@online.microsoft.com

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 12 '05 #6
Mark,
Sorry for the delay. This does seem like a bug and unfortunately there
aren't any good workarounds I could come up with, but I'm still looking and
will let you know.

Nov 12 '05 #7
Mark,
I've confirmed that the part of the article that casts the return from the
webmethod to an array of items should result in a invalid cast exception.
That section of the article needs to be changed.

To workaround the problem:

1. Have the webmethod return xmldocument/xmldatadocument (similar to the
example described earlier in the same article) Or
2. Create 2 webmethods. One webmethod that returns the class type, and the
other that returns xml data.

Thanks,
syed ..
Microsoft Developer Support

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: cody | last post by:
I've seen an Introduction on ADO.NET with its Datasets on .NET TV and Iam now wondering how it is realized/used in real world applications. I don't believe that one would create a dataset and add...
2
by: IcedCrow | last post by:
#1) Burning question on my mind is ... what is the difference between a "web service" and a distributed COM component other then a distributed COM component had to be registered on a host server...
1
by: Dacuna | last post by:
Can a Web Service return a dataset? If so, what are the limitations of a Web Service when you compare it to a DCOM DLL? -- Thank you for your help
1
by: JJ | last post by:
Hi, I am wondering if I create a diffgram dataset and I save the dataset to file and then want to commit the dataset to the database. I would assume that I would use a DataAdapter to help commit...
0
by: Bj?rn Mor?n | last post by:
I am consuming a web service that returns arrays of classes which can contain other classes (a hierarchy of data). Is there a simple way to move the data into a typed DataSet without writing too...
1
by: Raj | last post by:
Hi, This is regarding using Arrays of UDT's in COM. The following is a short description: - We basically need a structure, struct MAIN_STRUCT which must contain a dynamic array of another...
7
by: Stu | last post by:
Hi, I have a web service which returns a record set and works well integrated with an asp dot net page. However if I decided to develop a unix app will i be able to read the dataset as it is...
3
by: Demetri | last post by:
Hello, My company has charged me with creating a web service that will validate a user and return the user's roles via Active Directory. The requirement is that the web service must return...
3
by: =?Utf-8?B?SXbDoW4gUMOpcmV6?= | last post by:
Hi there, I have a question that has been raised on how an application should handle the data that is travelling through a three-layered application. Our data is going to be handled by Dataset...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.