I am having problem compiling schema contained in WSDL file when analyzing
schema types contained in it (for example
http://www.ebout.net/net/GoogleSearch.wsdl).
Following code demonstrates my problem:
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Net;
using System.Web.Services.Description;
namespace ProblemDemonstration
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
//populate ServiceDescription
string s = @"http://www.ebout.net/net/GoogleSearch.wsdl";
//string s = @"http://sdm.lbl.gov/srm-wg/srm.v1.1.wsdl";
WebRequest oRequest = WebRequest.Create(s);
WebResponse oResponse = oRequest.GetResponse();
Stream oStream = oResponse.GetResponseStream();
ServiceDescription oServiceDescription = ServiceDescription.Read(oStream);
oStream.Close();
oResponse.Close();
//compile schema in it
XmlSchema oSchema = oServiceDescription.Types.Schemas[0];
oSchema.Compile(new ValidationEventHandler(ValidationHandler), new
XmlUrlResolver());
}
private static void ValidationHandler(object sender, ValidationEventArgs e)
{
Debug.WriteLine(e.Message);
}
}
}
It produces following validation events:
Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be
referenced in this schema.
Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be
referenced in this schema.
Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be
referenced in this schema.
Namespace 'http://schemas.xmlsoap.org/soap/encoding/' is not available to be
referenced in this schema.
Undefined complexType 'http://schemas.xmlsoap.org/soap/encoding/:Array' is
used as a base for complex type restriction".
Undefined complexType 'http://schemas.xmlsoap.org/soap/encoding/:Array' is
used as a base for complex type restriction".
I must be missing some fundamental step but I cannot figure out what it is.
Any suggestion will be of great help.
PS:
I can import this WebService into the Visual Studio just fine but when I try
to use WSDL.EXE tool like this, it reports the same errors.
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin>wsdl /l:cs
/o:GoogleProxy.cs http://www.ebout.net/net/GoogleSearch.wsdl
/n:GoogleWebService
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Schema validation warning: Namespace
'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced
in this schema.
Schema validation warning: Namespace
'http://schemas.xmlsoap.org/soap/encoding/' is not available to be referenced
in this schema.
Writing file 'GoogleProxy.cs'.