.NETGURU
Pleeeeeese: NOTANSWERED BEFORE: Invalid URI Exception
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngescalate' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Devin Rader
Can no one help me with this? I get the Invalid URI Schema exception no
matter what I try to do with the resulting XML other than putting it into an
XML Document object, which I really don't want to do.

Thanks?

Devin

No Problem...

Heres most of the code in the Method:

HttpWebRequest w = (HttpWebRequest)WebRequest.Create(strURL);
w.Credentials=new System.Net.NetworkCredential("User", "Password",
"DMA");
w.Method="SEARCH";
w.ContentType="text/xml";
w.ContentLength = System.Text.Encoding.ASCII.GetChars(tmp).Length;

StreamWriter s = new
StreamWriter(w.GetRequestStream(),System.Text.Encoding.ASCII);
s.Write(System.Text.Encoding.ASCII.GetChars(tmp));
s.Flush();
s.Close();

w.Accept HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT"];
w.Headers["Accept-Language"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];
w.Headers.Add("depth","0");

w.Headers.Add("translate", "f");
w.Headers["Accept-Encoding"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_ENCODING"];
w.UserAgent HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];

try
{
HttpWebResponse r = (HttpWebResponse)w.GetResponse();

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
}
catch (Exception exc)
{}

You can see that the XML is begin returned from a HttpWebRequest via an
HttpWebResponse object, and is then loaded into an StreamReader.

I have been able to create a new XmlDocument object and load the XML into
that, but I really wanted to load it into a DataSet, rather then having to
work with the DOM.

The XML returned from the WebDAV request looks like this:

<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:d="urn:schemas-microsoft-com:office:office"
xmlns:a="DAV:">

<a:response>
<a:href>
http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML
<http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML> </a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>dcxfxcvxcv.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
<a:response>
<a:href>
http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML
<http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML> </a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>sdfsdfsdfsdf.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

-----Original Message-----
From: Little, Ambrose [ mailto:Click here to reveal e-mail address
<mailto:Click here to reveal e-mail address> ]
Sent: Friday, March 22, 2002 4:28 PM
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

Don't suppose you could show us the code that builds the "r" object?
My experience with that exception is that it was not a fully-formed URI.

--Ambrose

-----Original Message-----
From: Devin Rader [ mailto:Click here to reveal e-mail address
<mailto:Click here to reveal e-mail address> ]
Sent: Friday, 22 March, 2002 15:32
To: aspngescalate
Subject: [aspngescalate] NOTANSWERED BEFORE: Invalid URI Exception

I am trying to load some XML from a WebDAV query into a dataset but keep
getting an Invalid URI exception. Heres the code:
StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
Any ideas why?
Thanks
Devin
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp
<http://www.asplists.com/asplists/aspngxml.asp> = JOIN/QUIT
| http://www.asplists.com/search <http://www.asplists.com/search> = SEARCH
Archives

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp
<http://www.asplists.com/asplists/aspngescalate.asp> = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp
<http://www.asplists.com/asplists/aspngescalate.asp> = JOIN/QUIT

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
Reply to this message...
 
    
Mitch Denny (VIP)
Devin,

Looking at the data, it looks like there is a slight
chance the DataSet will be able to determine a sensible
form from the response. What is happening I suspect
is that it is having troubles with the URI's defined
in the xmlns:.... attributes. What I would consider
doing is reading in a local copy with those URI's
modified to be something much simpler.

For example, repleace "DAV:" with "dav". At this point
in the process we just want to determine what is
making the read barf.

----------------------------------------
- Mitch Denny
- Click here to reveal e-mail address
- +61 (414) 610-141
-

-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Tuesday, 26 March 2002 04:26
To: aspngescalate
Subject: [aspngescalate] Pleeeeeese: NOTANSWERED BEFORE: Invalid URI
Exception

Can no one help me with this? I get the Invalid URI Schema exception no
matter what I try to do with the resulting XML other than putting it
into an XML Document object, which I really don't want to do.

Thanks?

Devin

No Problem...
Heres most of the code in the Method:
HttpWebRequest w = (HttpWebRequest)WebRequest.Create(strURL);
w.Credentials=new System.Net.NetworkCredential("User",
"Password", "DMA");
w.Method="SEARCH";
w.ContentType="text/xml";
w.ContentLength =
System.Text.Encoding.ASCII.GetChars(tmp).Length;

StreamWriter s = new
StreamWriter(w.GetRequestStream(),System.Text.Encoding.ASCII);
s.Write(System.Text.Encoding.ASCII.GetChars(tmp));
s.Flush();
s.Close();

w.Accept =
HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT"];
w.Headers["Accept-Language"] =
HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];
w.Headers.Add("depth","0");

w.Headers.Add("translate", "f");
w.Headers["Accept-Encoding"] =
HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_ENCODING"];
w.UserAgent =
HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];

try
{
HttpWebResponse r = (HttpWebResponse)w.GetResponse();

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
}
catch (Exception exc)
{}
You can see that the XML is begin returned from a HttpWebRequest via an
HttpWebResponse object, and is then loaded into an StreamReader.
I have been able to create a new XmlDocument object and load the XML
into that, but I really wanted to load it into a DataSet, rather then
having to work with the DOM.
The XML returned from the WebDAV request looks like this:
<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:d="urn:schemas-microsoft-com:office:office"
xmlns:a="DAV:">
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML</a
:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>dcxfxcvxcv.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML<
/a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>sdfsdfsdfsdf.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

-----Original Message-----
From: Little, Ambrose [mailto:Click here to reveal e-mail address]
Sent: Friday, March 22, 2002 4:28 PM
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

Don't suppose you could show us the code that builds the "r" object?
My experience with that exception is that it was not a fully-formed URI.

--Ambrose
-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Friday, 22 March, 2002 15:32
To: aspngescalate
Subject: [aspngescalate] NOTANSWERED BEFORE: Invalid URI Exception

I am trying to load some XML from a WebDAV query into a dataset but keep

getting an Invalid URI exception. Heres the code:
StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
Any ideas why?
Thanks
Devin
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT

Reply to this message...
 
 
System.Data.DataSet
System.Data.XmlReadMode
System.IO.StreamReader
System.IO.StreamWriter
System.Net.HttpWebRequest
System.Net.HttpWebResponse
System.Net.NetworkCredential
System.Net.WebRequest
System.Text.Encoding
System.Web.HttpContext
System.Xml.XmlDocument




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification