By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,310 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,310 IT Pros & Developers. It's quick & easy.

use xsd.exe and wsdl.exe to go from XML to web service interface ?

P: n/a
I'd like to generate my WebService interface from an XSD schema. Here's what
I've done:

1. created a XML file
2. use the xsd.exe to generate the XSD:
C:\>xsd my.xml
3. my.xsd is generated
4. try to generate the WebService interface using wsdl.exe:
C:\>wsdl /serverInterface /protocol:SOAP my.xsd
5. An error occurs and no classes are generated (see below) and Interface.cs
is empty.

What have I done wrong? Can wsdl.exe be used to generate the server
interface from xsd files?

======
C:\>wsdl /serverInterface /protocol:SOAP my.xsd
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Warning: This web reference does not conform to WS-I Basic Profile v1.1.
SOAP 1.1 binding was not found: WS-I's Basic Profile 1.1 consists of implemen
ion guidelines that recommend how a set of core Web services specifications s
ld be used together to develop interoperable Web services. For the 1.1 Profil
those specifications are SOAP 1.1, WSDL 1.1, UDDI 2.0, XML 1.0 and XML Schema

For more details on the WS-I Basic Profile v1.1, see the specification
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.

Warning: no classes were generated.
Warnings were encountered. Review generated source comments for more details.

Writing file 'C:\Interfaces.cs'.
Jan 29 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In tMighty Mark,

The following steps 1 - 3 does not have any problem

Step1
-----------------------------
Create the following XML
<root>
<EmpName>Sundar</EmpName>
<EmpAge>25</EmpAge>
<Height>173.5</Height>
</root>

Step2
-------
.. use the xsd.exe to generate the XSD:
C:\>xsd my.xml
Step3:
--------
my.xsd is generated. It looks like the following

In the step3 i got the following xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="EmpName" type="xs:string" minOccurs="0" />
<xs:element name="EmpAge" type="xs:string" minOccurs="0" />
<xs:element name="Height" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="root" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Step4
-------
Please use the Xsd tool again for the step4 in the following way.
Xsd My.xsd /C

The generated class interface looks like the following

//------------------------------------------------------------------------------
// <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("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="", IsNullable=false)]
public partial class root {

private string empNameField;

private string empAgeField;

private string heightField;

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string EmpName {
get {
return this.empNameField;
}
set {
this.empNameField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string EmpAge {
get {
return this.empAgeField;
}
set {
this.empAgeField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Height {
get {
return this.heightField;
}
set {
this.heightField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="", IsNullable=false)]
public partial class NewDataSet {

private root[] itemsField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("root ")]
public root[] Items {
get {
return this.itemsField;
}
set {
this.itemsField = value;
}
}
}
Please ket me know if this answers your question

--
Thanks & Regards,
Mark Nelson
"Mighty Mark" wrote:
I'd like to generate my WebService interface from an XSD schema. Here's what
I've done:

1. created a XML file
2. use the xsd.exe to generate the XSD:
C:\>xsd my.xml
3. my.xsd is generated
4. try to generate the WebService interface using wsdl.exe:
C:\>wsdl /serverInterface /protocol:SOAP my.xsd
5. An error occurs and no classes are generated (see below) and Interface.cs
is empty.

What have I done wrong? Can wsdl.exe be used to generate the server
interface from xsd files?

======
C:\>wsdl /serverInterface /protocol:SOAP my.xsd
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Warning: This web reference does not conform to WS-I Basic Profile v1.1.
SOAP 1.1 binding was not found: WS-I's Basic Profile 1.1 consists of implemen
ion guidelines that recommend how a set of core Web services specifications s
ld be used together to develop interoperable Web services. For the 1.1 Profil
those specifications are SOAP 1.1, WSDL 1.1, UDDI 2.0, XML 1.0 and XML Schema

For more details on the WS-I Basic Profile v1.1, see the specification
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.

Warning: no classes were generated.
Warnings were encountered. Review generated source comments for more details.

Writing file 'C:\Interfaces.cs'.
Jan 30 '07 #2

P: n/a
Any updates, did you proceed further ?
Please let me know whether my post was useful.
--
Thanks & Regards,
Mark Nelson
"Mark Nelson" wrote:
In tMighty Mark,

The following steps 1 - 3 does not have any problem

Step1
-----------------------------
Create the following XML
<root>
<EmpName>Sundar</EmpName>
<EmpAge>25</EmpAge>
<Height>173.5</Height>
</root>

Step2
-------
. use the xsd.exe to generate the XSD:
C:\>xsd my.xml
Step3:
--------
my.xsd is generated. It looks like the following

In the step3 i got the following xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="EmpName" type="xs:string" minOccurs="0" />
<xs:element name="EmpAge" type="xs:string" minOccurs="0" />
<xs:element name="Height" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="root" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Step4
-------
Please use the Xsd tool again for the step4 in the following way.
Xsd My.xsd /C

The generated class interface looks like the following

//------------------------------------------------------------------------------
// <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("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="", IsNullable=false)]
public partial class root {

private string empNameField;

private string empAgeField;

private string heightField;

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string EmpName {
get {
return this.empNameField;
}
set {
this.empNameField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string EmpAge {
get {
return this.empAgeField;
}
set {
this.empAgeField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Height {
get {
return this.heightField;
}
set {
this.heightField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespac e="", IsNullable=false)]
public partial class NewDataSet {

private root[] itemsField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("root ")]
public root[] Items {
get {
return this.itemsField;
}
set {
this.itemsField = value;
}
}
}
Please ket me know if this answers your question

--
Thanks & Regards,
Mark Nelson
"Mighty Mark" wrote:
I'd like to generate my WebService interface from an XSD schema. Here's what
I've done:

1. created a XML file
2. use the xsd.exe to generate the XSD:
C:\>xsd my.xml
3. my.xsd is generated
4. try to generate the WebService interface using wsdl.exe:
C:\>wsdl /serverInterface /protocol:SOAP my.xsd
5. An error occurs and no classes are generated (see below) and Interface.cs
is empty.

What have I done wrong? Can wsdl.exe be used to generate the server
interface from xsd files?

======
C:\>wsdl /serverInterface /protocol:SOAP my.xsd
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Warning: This web reference does not conform to WS-I Basic Profile v1.1.
SOAP 1.1 binding was not found: WS-I's Basic Profile 1.1 consists of implemen
ion guidelines that recommend how a set of core Web services specifications s
ld be used together to develop interoperable Web services. For the 1.1 Profil
those specifications are SOAP 1.1, WSDL 1.1, UDDI 2.0, XML 1.0 and XML Schema

For more details on the WS-I Basic Profile v1.1, see the specification
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.

Warning: no classes were generated.
Warnings were encountered. Review generated source comments for more details.

Writing file 'C:\Interfaces.cs'.
Feb 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.