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.Diagnost ics;
using System.IO;
using System.Xml;
using System.Xml.Sche ma;
using System.Net;
using System.Web.Serv ices.Descriptio n;
namespace ProblemDemonstr ation
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
//populate ServiceDescript ion
string s = @"http://www.ebout.net/net/GoogleSearch.ws dl";
//string s = @"http://sdm.lbl.gov/srm-wg/srm.v1.1.wsdl";
WebRequest oRequest = WebRequest.Crea te(s);
WebResponse oResponse = oRequest.GetRes ponse();
Stream oStream = oResponse.GetRe sponseStream();
ServiceDescript ion oServiceDescrip tion = ServiceDescript ion.Read(oStrea m);
oStream.Close() ;
oResponse.Close ();
//compile schema in it
XmlSchema oSchema = oServiceDescrip tion.Types.Sche mas[0];
oSchema.Compile (new ValidationEvent Handler(Validat ionHandler), new
XmlUrlResolver( ));
}
private static void ValidationHandl er(object sender, ValidationEvent Args 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\B in>wsdl /l:cs
/o:GoogleProxy.c s http://www.ebout.net/net/GoogleSearch.wsdl
/n:GoogleWebServ ice
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 '.
schema types contained in it (for example
http://www.ebout.net/net/GoogleSearch.wsdl).
Following code demonstrates my problem:
using System.Diagnost ics;
using System.IO;
using System.Xml;
using System.Xml.Sche ma;
using System.Net;
using System.Web.Serv ices.Descriptio n;
namespace ProblemDemonstr ation
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
//populate ServiceDescript ion
string s = @"http://www.ebout.net/net/GoogleSearch.ws dl";
//string s = @"http://sdm.lbl.gov/srm-wg/srm.v1.1.wsdl";
WebRequest oRequest = WebRequest.Crea te(s);
WebResponse oResponse = oRequest.GetRes ponse();
Stream oStream = oResponse.GetRe sponseStream();
ServiceDescript ion oServiceDescrip tion = ServiceDescript ion.Read(oStrea m);
oStream.Close() ;
oResponse.Close ();
//compile schema in it
XmlSchema oSchema = oServiceDescrip tion.Types.Sche mas[0];
oSchema.Compile (new ValidationEvent Handler(Validat ionHandler), new
XmlUrlResolver( ));
}
private static void ValidationHandl er(object sender, ValidationEvent Args 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\B in>wsdl /l:cs
/o:GoogleProxy.c s http://www.ebout.net/net/GoogleSearch.wsdl
/n:GoogleWebServ ice
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 '.
Comment