Problem Importing Schema

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ali

    #1

    Problem Importing Schema

    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 '.

  • CG

    #2
    RE: Problem Importing Schema

    I compiled your code. it worked like a champ. I am not sure why you are
    getting that error.

    try again....

    "Ali" wrote:
    [color=blue]
    > 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 '.
    >[/color]

    Comment

    • Tomas

      #3
      RE: Problem Importing Schema

      Code works but event handler is reporting errors. Did you look at the Output
      (it uses Debug.Writeline )?

      Tomas

      "CG" wrote:
      [color=blue]
      > I compiled your code. it worked like a champ. I am not sure why you are
      > getting that error.
      >
      > try again....
      >
      > "Ali" wrote:
      >[color=green]
      > > 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 '.
      > >[/color][/color]

      Comment

      Working...