Results 1 to 13 of 13

Thread: How get xml data from browser

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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

  4. #4
    Fanatic Member karthikeyan's Avatar
    Join Date
    Oct 2005
    Location
    inside .net
    Posts
    919

    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.
    Loving dotnet

  5. #5
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    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

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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

  8. #8
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: How get xml data from browser

    Have you imported this namespace in your application ?

    vb Code:
    1. Imports System.Net
    2. Imports System.IO
    Please mark you thread resolved using the Thread Tools as shown

  9. #9
    Fanatic Member karthikeyan's Avatar
    Join Date
    Oct 2005
    Location
    inside .net
    Posts
    919

    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.
    Loving dotnet

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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

  13. #13
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width