|
-
Jan 20th, 2009, 04:27 AM
#1
Thread Starter
Addicted Member
How get xml data from browser
Dear friends,
I am using Asp.Net application. What my problem actually that i got output in
xml in the browser. For ex :<NewDataSet>
<Table>
<strTemplateName>TepWap</strTemplateName>
<strPath>http://mob.i-waves.com/ford/</strPath>
<strTemplateId>0999</strTemplateId>
</Table>
</NewDataSet> . I got this output in my browser. Now i want to get data only ie TepWap, http://mob.i-waves.com/ford and 0999. It is possible. If possible please let me know.
Hope your's reply soon.
Thanks & Regards
Failing to plan is Planning to fail 
-
Jan 20th, 2009, 04:31 AM
#2
Re: How get xml data from browser
Do you want to get the output from WebBrowser ?
Please mark you thread resolved using the Thread Tools as shown
-
Jan 20th, 2009, 04:34 AM
#3
Thread Starter
Addicted Member
Re: How get xml data from browser
yes i want to get this data from web browser.
<NewDataSet>
<Table>
<strTemplateName>TepWap</strTemplateName>
<strPath>http://mob.i-waves.com/ford/</strPath>
<strTemplateId>0999</strTemplateId>
</Table>
This is i got the output in the browser. Now i call the function and get three data's from web browser.
Failing to plan is Planning to fail 
-
Jan 20th, 2009, 04:42 AM
#4
Fanatic Member
Re: How get xml data from browser
Hi,
Are you using webservice? because web service displays the result in the form of xml.
how did u get the result set like this? can you tell me the way you generate the xml file. so that i could help you.
-
Jan 20th, 2009, 04:51 AM
#5
Re: How get xml data from browser
This will retrive the page content
Code:
Dim myReq As Net.HttpWebRequest = _
WebRequest.Create("Your page addresss")
Dim resp As HttpWebResponse = CType(myReq.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream = resp.GetResponseStream()
Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)
Response.Write(readStream.ReadToEnd())
Then you could load the xml in DOM
Please mark you thread resolved using the Thread Tools as shown
-
Jan 20th, 2009, 04:54 AM
#6
Thread Starter
Addicted Member
Re: How get xml data from browser
yes i am using web services. Using GetXml() method convert from dataset and return the xml .
strSelectTemplateDetails = "select strTemplateName,strPath,strTemplateId from tblPredefinedTemplates where strServiceType='" & strServiceType & "'"
dsTemplateDetails = objClsContentDb.GetRecordSet(strSelectTemplateDetails)
strXml = dsTemplateDetails.GetXml()
Return strXml
But my question is i want to get this xml data from web browser for some purpose.
Failing to plan is Planning to fail 
-
Jan 20th, 2009, 05:33 AM
#7
Thread Starter
Addicted Member
Re: How get xml data from browser
Hi,
Dim myReq As Net.HttpWebRequest = WebRequest.Create("WebCP.asmx")
Dim resp As HttpResponse = CType(myReq.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream = resp.GetResponseStream()
Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)
Response.Write(readStream)
I implement this in my application. But i got an error that
Dim receiveStream As Stream = resp.GetResponseStream()
Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)
1."GetResponseStream" is not a member "System.Web.HttpResponse"
2.value of type system.net.httpwebresponse cannot be converted to system.web.httpresponse
Two errors are occurred
Failing to plan is Planning to fail 
-
Jan 20th, 2009, 07:15 AM
#8
Re: How get xml data from browser
Have you imported this namespace in your application ?
vb Code:
Imports System.Net Imports System.IO
Please mark you thread resolved using the Thread Tools as shown
-
Jan 20th, 2009, 07:16 AM
#9
Fanatic Member
Re: How get xml data from browser
Hi,
wirte a web method which returns dataset in the web service and jsut call the webservice method and assign the retreived object in your code behind's dataset. then convert it as xml and read it.
Still you don't understand please let me know.
-
Jan 20th, 2009, 07:17 AM
#10
Thread Starter
Addicted Member
Re: How get xml data from browser
yes i import the both namespace.
But i am having the same error.
Failing to plan is Planning to fail 
-
Jan 20th, 2009, 01:42 PM
#11
Re: How get xml data from browser
Right click your solution, add web reference. Now give it the URL of your web service. Give it a proper name such as "MobiService". Once it finds everything it needs, then you can use it like a class.
Code:
Dim client as new MobiService.ServiceName()
Dim doc As XmlDocument = client.MethodName()
doc now contains your XML from the web service.
-
Jan 21st, 2009, 12:48 AM
#12
Thread Starter
Addicted Member
Re: How get xml data from browser
oops !!!!
mendhak its working.. great !!!. Thanks.
I got output that what i need. :-)
Failing to plan is Planning to fail 
-
Jan 21st, 2009, 02:45 AM
#13
Re: How get xml data from browser
Good to know, add resolved to the titles for others.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|