I have a web service that's serializing a class (class is from the web service) into an MSMQ, then a windows service is checking the queue and deserializing. The windows service has a web reference to get the class.
If I deserialize inside the web service, everything comes out fine. However, when I deserialize from the windows service everything works except two string arrays that are coming out as null, so I believe something is not getting transferred properly over the web reference.
Here's a snippet from the class in question:
[Serializable, XmlInclude(typeof(EmailType))]
public partial class Email
{
[System.Xml.Serialization.XmlElement("BodyParameters")]
public string[] BodyParameters
{
get
{
return this.bodyParameters;
}
set
{
this.bodyParameters = value;
}
}
[System.Xml.Serialization.XmlElement("SubjectParameters")]
public string[] SubjectParameters
{
get
{
return this.subjectParameters;
}
set
{
this.subjectParameters = value;
}
}
}
The Reference.cs file I get in my windows service looks like this:
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("BodyParameters")]
public string[] BodyParameters {
get {
return this.bodyParametersField;
}
set {
this.bodyParametersField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SubjectParameters")]
public string[] SubjectParameters {
get {
return this.subjectParametersField;
}
set {
this.subjectParametersField = value;
}
}
Is there some special way I have to reference the class or set up the string[]'s in the class for it to be referenced properly?
Here's the output I get if I serialize to a file:
<?xml version="1.0" encoding="utf-8"?>
<Email xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MessageType="None" PackageID="0" To="[email protected]" Subject="testing..." Body="this is a test" IsHTML="false">
<BodyParameters>one two</BodyParameters>
<BodyParameters>three four</BodyParameters>
<BodyParameters>test test</BodyParameters>
<SubjectParameters>foo</SubjectParameters>
</Email>
Keep in mind, everything except BodyParameters and SubjectParameters comes out fine in the windows service. Web service, everything works.