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