all groups > dotnet web services > september 2005 >
You're in the

dotnet web services

group:

Webservice using strong-named arrays: Generating XML document failed


Webservice using strong-named arrays: Generating XML document failed Roland Dick
9/28/2005 9:41:38 AM
dotnet web services:
Hi,

I'm desperate with a webservice and a consuming WinForms-client. It used
to work well, but all of a sudden (= I don't know what I changed really
:) I get an exception "Generating the XML document failed" ("Beim
Generieren des XML-Dokuments ist ein Fehler aufgetreten").

My code method looks like this:

=== Web service method ===
[WebMethod]
[XmlInclude(typeof(myClass))]
public myInheritedClass[] DoOperation(myClass[] Objects, string LicenseKey)
{
....
}

=== Business class myClass ===
[Serializable()]
[System.Xml.Serialization.XmlInclude(typeof(myInheritedClass))]
public class myClass
{
private int _PK;
private string _Value1;
private string _Value2;
private string _Value3;
private string _Value4;
private myDetailClass _Details;

// public get/set accessors for each member
}

=== Business class myInheritedClass ===
[Serializable()]
public class myInheritedClass: myClass
{
private QueryResult _result;

public mdbApplicationFileCommand()
{
}

public enum QueryResult { OK, OutOfDate, NotUsed, New }
}

=== Business class myDetailClass ===
[Serializable()]
public class myDetailClass
{
private int _DetPK;
private int _DetValue1;
private int _DetValue2;
private int _DetValue3;
private int _DetValue4;
private int _DetValue5;
private string _DetMyString;

public mdbApplicationFileDB()
{
}

// get/set accessors for all members
}

The client proxy gets generated without glitch, but at runtime, when the
client calls the web service method DoOperation, I get the exception
described above (Inner Exception is an InvalidCastException).

I'm lost here... can somebody help me? (I'll shout a beer on the
Oktoberfest :-)

Thanks for any hints,

Re: Webservice using strong-named arrays: Generating XML document failed Roland Dick
9/28/2005 10:44:58 AM
Now it works again. The funny thing is: I did not change anything in the
code. The only thing I changed was adding the diagnostics switch

<system.diagnostics>
<switches>
<add name="XmlSerialization.Compilation" value="4" />
</switches>
</system.diagnostics>

to the app.config.

Even if I delete that switch (or the whole app.config), it still works.

Does anybody know what could be the reason for this behaviour? If the
client app is out with the customers... will it stop working again?

Confused,

AddThis Social Bookmark Button