O
ohioguy
I would like to pass a class to a Web Service. I have created an xsd
file and have converted it to a class using the following command:
xsd HelloWorldSchema.xsd /c /l:cs
The class file is generated but the Service.cs file is not recognizing
the new class. I've posted the code in hopes someone will see
something I am apparently not seeing.
How can I use this class in the web services to create a method like
this:
[WebMethod]
public void AcceptSchema (foo f)
Is this even possible?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's the code of the HelloWorldSchema.xsd file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/
2001/XMLSchema">
<xs:element name="foo" type="foo">
</xs:element>
<xs:complexType name="foo">
<xs:sequence>
<xs:element name="bar" type="xs:string" />
<xs:element name="test" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is the code for HelloWorldSchema.cs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=2.0.50727.42.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://
testSchema", IsNullable=false)]
public partial class foo {
private string barField;
private string testField;
/// <remarks/>
public string bar {
get {
return this.barField;
}
set {
this.barField = value;
}
}
/// <remarks/>
public string test {
get {
return this.testField;
}
set {
this.testField = value;
}
}
}
file and have converted it to a class using the following command:
xsd HelloWorldSchema.xsd /c /l:cs
The class file is generated but the Service.cs file is not recognizing
the new class. I've posted the code in hopes someone will see
something I am apparently not seeing.
How can I use this class in the web services to create a method like
this:
[WebMethod]
public void AcceptSchema (foo f)
Is this even possible?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's the code of the HelloWorldSchema.xsd file:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/
2001/XMLSchema">
<xs:element name="foo" type="foo">
</xs:element>
<xs:complexType name="foo">
<xs:sequence>
<xs:element name="bar" type="xs:string" />
<xs:element name="test" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is the code for HelloWorldSchema.cs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be
lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Xml.Serialization;
//
// This source code was auto-generated by xsd, Version=2.0.50727.42.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://
testSchema", IsNullable=false)]
public partial class foo {
private string barField;
private string testField;
/// <remarks/>
public string bar {
get {
return this.barField;
}
set {
this.barField = value;
}
}
/// <remarks/>
public string test {
get {
return this.testField;
}
set {
this.testField = value;
}
}
}