• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2935
  • Last Modified:

What is the VB.Net Equivelant to Server.CreateObject("MSXML2.ServerXMLHTTP")

How do I use something like Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP") in a VB.Net app? I'm trying to migrate a ASP app over.

Thanks
0
greddin
Asked:
greddin
  • 12
  • 10
1 Solution
 
Bob LearnedCommented:
What are you doing with that object?

Bob
0
 
greddinAuthor Commented:
Making a remote connection in classic asp to a web service.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Bob LearnedCommented:
Are you looking to connect to a web service in ASP.NET?

Bob
0
 
greddinAuthor Commented:
Yes, I would like to connect to it and paginate through the results.  How could I implement pagination? Could I fill a datagrid with the web service data?
0
 
Bob LearnedCommented:
Do you need the steps to connect to a web service?  The steps are different for ASP.NET.  You won't need that MSXML2.ServerXMLHTTP object.

It depends on what the web service method returns.  If it is a DataSet, then you can define a DataGrid, and set up pagination.

Bob
0
 
greddinAuthor Commented:
Not a problem. I can connect to the web service. But the web service returns a large about of data. Around 500 rows. I was just trying to implement pagination such as this article shows:

http://www.codeproject.com/aspnet/XSLTransform.asp

0
 
Bob LearnedCommented:
What does the web method return?

Bob
0
 
greddinAuthor Commented:
It not a dataset but just a lot of xml: Here's a snippet.

 <?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfDocument xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="CancerConsultants.Syndication">
- <Document>
  <DocumentID>36733</DocumentID>
  <FolderID>427</FolderID>
  <Title>Additional Evidence that Herceptin® Benefits Women with HER2-Positive Breast Cancer</Title>
  <Description>According to the results of a study conducted in Italy, women with metastatic HER2-positive breast cancer who were treated with Herceptin&#174; (trastuzumab) and Navelbine&#174; (vinorelbine) had better outcomes than a similar group of women with HER2-negative breast cancer who were treated with Navelbine alone. These results were published in the <i>Annals of Oncology</i>.</Description>
  <Created>2006-04-17T17:05:57.0000000-05:00</Created>
  <LastEdited>2006-04-17T17:07:12.0000000-05:00</LastEdited>
  </Document>
- <Document>
  <DocumentID>36730</DocumentID>
  <FolderID>448</FolderID>
  <Title>Vaginal Estrogen Use May Counteract Anticancer Activity of Aromatase Inhibitors in Women with Breast Cancer</Title>
  <Description>According to an article recently published in the <i>Annals of Oncology,</i> the use of vaginal estrogen preparations may raise estrogen levels throughout the body and may counteract the anticancer activity of aromatase inhibitors in women with breast cancer. However, women being treated with aromatase inhibitors should speak with their physician regarding their individual risks and benefits of vaginal estrogen supplementation.</Description>
  <Created>2006-04-17T14:56:17.0000000-05:00</Created>
  <LastEdited>2006-04-17T14:58:03.0000000-05:00</LastEdited>
  </Document>
- <Document>
  <DocumentID>36727</DocumentID>
  <FolderID>427</FolderID>
  <Title>Addition of Taxotere® to Neoadjuvant Chemotherapy Doesn’t Affect Overall Survival</Title>
  <Description>Among women with operable breast cancer who received preoperative chemotherapy with doxorubicin and cyclophosphamide, the addition of preoperative or postoperative Taxotere&#174; (docetaxel) did not significantly improve overall survival. These results were published in the <i>Journal of Clinical Oncology</i>.</Description>
  <Created>2006-04-17T12:53:26.0000000-05:00</Created>
  <LastEdited>2006-04-17T12:55:12.0000000-05:00</LastEdited>
  </Document>
</ArrayOfDocument>
0
 
Bob LearnedCommented:
If you are getting XML text, then you can use the DataSet.ReadXml(stream) method to create a DataSet, that you can bind a DataGrid to.  Just construct a MemoryStream and feed it to the ReadXml method call.

Bob
0
 
greddinAuthor Commented:
Bob, I have increased the points to 500. Could I send you the connection string (which contains username and password) via email? I could also send you my current VB.Net project that is already making the connection and displaying data. Just not paged.

-Greg
0
 
Bob LearnedCommented:
Not necessary--this can be done over the wire, without seeing any of that.  If you can display data, are you saying that you don't understand how to implement paging with the ASP.NET DataGrid?

Bob
0
 
greddinAuthor Commented:
Yes, I'm lacking in the process of creating the dataset or datagrid and populating it with the xml data returned from the Web Service.

Here is my current VB.Net code that is displaying:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim documentsSyndication As New CancerConsultants.Syndication.Documents.CancerConsultantsSyndicationDocuments
        Dim newsSyndication As New CancerConsultants.Syndication.News.CancerConsultantsSyndicationNews
        Dim documents As CancerConsultants.Syndication.News.Document()
        Dim limit As Integer = 10

        If Request.QueryString("id") = "" Then
            documents = newsSyndication.GetLatestPatientNews("komen", "password", limit)

            For Each document As CancerConsultants.Syndication.News.Document In documents
                uxLatestNewsLiteral.Text &= "<p><a href=""?id=" & document.DocumentID & """>" & document.Title & "</a>"
                uxLatestNewsLiteral.Text &= " (<i>" & document.Created & "</i>)<br />"
                uxLatestNewsLiteral.Text &= "<span style=""font-size:10px;"">" & document.Description & "</span></p>"
            Next

            uxLatestNewsLiteral.Visible = True
            uxDocumentXML.Visible = False
        Else
            uxDocumentXML.DocumentContent = documentsSyndication.GetContent("komen", "password", Convert.ToInt32(Request.QueryString("id"))).ContentXML

            uxLatestNewsLiteral.Visible = False
            uxDocumentXML.Visible = True
        End If

    End Sub

Thank you,
-Greg
0
 
Bob LearnedCommented:
Greg,

Are you getting the XML string from the web service with this call?

   uxDocumentXML.DocumentContent

Bob
0
 
greddinAuthor Commented:
Sorry, I should have explained. There are actually two different services here. What the ASP.NET page does when it first loads is display all the the rows (documents) of the xml file. Basically is there's not a querystring "id" it calls the newsSyndication.GetLatestPatientNews method.

Secondly, after the page is populated an article can be clicked on which then calls the documentsSyndication.GetContent method. This calls another web service that pulls out the full details of this document only.

So the second part is not my problem. It's the "GetLatestPatientNews" that's the one needing paging.

Thank you.
-Greg
0
 
Bob LearnedCommented:
What is documents (Document) then?

Bob
0
 
greddinAuthor Commented:
documents is just an array of all the list of "document" nodes in the returned xml. It's the full list that needs to be paged. Is this what you're asking?
0
 
Bob LearnedCommented:
Yes, that is what I was asking for.  I was trying to see where you were loading the XML, but I don't think that it is there.  So, we'll go from here:

   Dim buffer() As Byte = System.Text.Encoding.UTF8.GetBytes(xmlText)
   Dim ms As New System.IO.MemoryStream(buffer)
   Dim ds As New DataSet
   ds.ReadXml(ms)
   DataGrid1.DataSource = ds.Tables(0)
   DataGrid1.DataBind()

NOTE:  xmlText is the XML text string that you get back from the web service.

Bob
0
 
greddinAuthor Commented:
Ok, I would assume that I'd just put in my "documents" variable where you pass the xmlText. But I get this error:

c:\inetpub\wwwroot\CancerConsultantsVB\WebForm2.aspx.vb(54): Overload resolution failed because no accessible 'GetBytes' can be called with these arguments:
    'Public Overridable Function GetBytes(s As String) As Byte()': Value of type '1-dimensional array of CancerConsultantsVB.CancerConsultants.Syndication.News.Document' cannot be converted to 'String'.
    'Public Overridable Function GetBytes(chars() As Char) As Byte()': Value of type '1-dimensional array of CancerConsultantsVB.CancerConsultants.Syndication.News.Document' cannot be converted to '1-dimensional array of Char' because 'CancerConsultantsVB.CancerConsultants.Syndication.News.Document' is not derived from 'Char'.

Do you know what I should put in this place?

Thanks.
0
 
Bob LearnedCommented:
That was what I was trying to find out before.  Where do you call the web method to get the XML string result back?

Bob
0
 
greddinAuthor Commented:
The Web service is added as an exteranal web reference.
0
 
Bob LearnedCommented:
That's all well and good, but I don't see where you are calling the web method.

Bob
0
 
Bob LearnedCommented:
Delete/No Refund
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 12
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now