364,085 Members | 5289 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

IXmlSerializable GetSchema Bug in wsdl.exe, Help ?

Leepe
P: n/a
Leepe
example:
I have a skill object that implements the XmlSerializable interface
Implementing the getschema gives me some unwanted generations towards
the wsdl.exe Reference.cs generation.

skill is an object with properties name and code

public System.Xml.Schema.XmlSchema GetSchema()
{
string _namespace;
System.Xml.Schema.XmlSchema output;
System.Xml.Schema.XmlSchemaElement skill, name, code;
System.Xml.Schema.XmlSchemaComplexType skillType;
System.Xml.Schema.XmlSchemaSequence sequence;

_namespace = "http://tempuri.org/Skill";
output = new System.Xml.Schema.XmlSchema();
output.Namespaces.Add("xsd", "http://www.w3.org/2001/XMLSchema");
output.Namespaces.Add("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
output.Namespaces.Add("tns", _namespace);
output.Id = "SkillShemaID";
output.TargetNamespace = _namespace;
skill = new System.Xml.Schema.XmlSchemaElement();
skill.Name = "Skill";
skillType = new System.Xml.Schema.XmlSchemaComplexType();

sequence = new System.Xml.Schema.XmlSchemaSequence();
name = new System.Xml.Schema.XmlSchemaElement();
name.Name = "Name";
name.SchemaTypeName = new System.Xml.XmlQualifiedName(
"string",
"http://www.w3.org/2001/XMLSchema"
);
sequence.Items.Add(name);
code = new System.Xml.Schema.XmlSchemaElement();
code.Name = "Code";
code.SchemaTypeName = new System.Xml.XmlQualifiedName(
"string",
"http://www.w3.org/2001/XMLSchema"
);
sequence.Items.Add(code);
skillType.Particle = sequence;
skill.SchemaType = skillType;
output.Items.Add(skill);

return output;

}

A Webservice is created, that only has a method GetSkill and this
returns the object Skill mentioned earlier.

The result in the wsdl is something like this:
<s:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://tempuri.org/Skill"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
targetNamespace="http://tempuri.org/Skill" id="SkillShemaID">
<xsd:element name="Skill">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Code" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</s:schema>

But using this wsdl by the wsdl.exe, so in my reference.cs file, this
will be generated as:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/GetSkill",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public SkillShemaID GetSkill(string SkillName, string code) {
object[] results = this.Invoke("GetSkill", new object[] {
SkillName,
code});
return ((SkillShemaID)(results[0]));

where SkillShemaID is the schema id in getschema but no code is
implemented in the reference.cs file to indicate this object.

Any Solutions to avoid this problem?
Custom generation is my last option.
I know that implementing this interface is not recommended by
microsoft but the standard serializer doesn' t help me and I was told
that in version 2.0 framework this will be supported.

Regards,
Steven
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


Leepe
P: n/a
Leepe
I have written my custom WSDL proxy generator for Custom Objects
Looks like Getschema has to many problems in the 1.1 version.

regards,
Steven
Nov 12 '05 #2

Post your reply

Help answer this question



Didn't find the answer to your .NET Framework question?

You can also browse similar questions: .NET Framework