468,121 Members | 1,531 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,121 developers. It's quick & easy.

IXmlSerializable GetSchema Bug in wsdl.exe, Help ?

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
1 3631
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

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Thomas D. | last post: by
1 post views Thread by theburnetts | last post: by
reply views Thread by valentin tihomirov | last post: by
reply views Thread by =?Utf-8?B?Ym9iYnk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.