ServerXMLHTTP40 eqivalent...

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

    #1

    ServerXMLHTTP40 eqivalent...

    In my ASP.Net application I'm trying to contact a host that does not have a
    web service, i.e.: a file with the asmx extension such as, anything.asmx.

    They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
    I've been communicating with them using VB 6.0 method for a couple years now
    and I'd like to update my application to use .Net.

    Is there a way I can communicate with this service using .Net?

    Thanks,

    King Wilder
  • Stefan Misch

    #2
    Re: ServerXMLHTTP40 eqivalent...

    HTTPWebRequest ?
    See
    http://msdn.microsoft.com/library/en...classtopic.asp
    for more details

    Stefan


    "K. Wilder" <KWilder@discus sions.microsoft .com> schrieb im Newsbeitrag
    news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=blue]
    > In my ASP.Net application I'm trying to contact a host that does not have
    > a
    > web service, i.e.: a file with the asmx extension such as, anything.asmx.
    >
    > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
    > I've been communicating with them using VB 6.0 method for a couple years
    > now
    > and I'd like to update my application to use .Net.
    >
    > Is there a way I can communicate with this service using .Net?
    >
    > Thanks,
    >
    > King Wilder[/color]


    Comment

    • Stefan Misch

      #3
      Re: ServerXMLHTTP40 eqivalent...

      HTTPWebRequest ?
      See
      http://msdn.microsoft.com/library/en...classtopic.asp
      for more details

      Stefan


      "K. Wilder" <KWilder@discus sions.microsoft .com> schrieb im Newsbeitrag
      news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=blue]
      > In my ASP.Net application I'm trying to contact a host that does not have
      > a
      > web service, i.e.: a file with the asmx extension such as, anything.asmx.
      >
      > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
      > I've been communicating with them using VB 6.0 method for a couple years
      > now
      > and I'd like to update my application to use .Net.
      >
      > Is there a way I can communicate with this service using .Net?
      >
      > Thanks,
      >
      > King Wilder[/color]


      Comment

      • Scott M.

        #4
        Re: ServerXMLHTTP40 eqivalent...

        You'd want the HTTPWebRequest but you wouldn't be using it with an .asmx
        file since .asmx files are exclusively for .NET web services.


        "K. Wilder" <KWilder@discus sions.microsoft .com> wrote in message
        news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=blue]
        > In my ASP.Net application I'm trying to contact a host that does not have
        > a
        > web service, i.e.: a file with the asmx extension such as, anything.asmx.
        >
        > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
        > I've been communicating with them using VB 6.0 method for a couple years
        > now
        > and I'd like to update my application to use .Net.
        >
        > Is there a way I can communicate with this service using .Net?
        >
        > Thanks,
        >
        > King Wilder[/color]


        Comment

        • Scott M.

          #5
          Re: ServerXMLHTTP40 eqivalent...

          You'd want the HTTPWebRequest but you wouldn't be using it with an .asmx
          file since .asmx files are exclusively for .NET web services.


          "K. Wilder" <KWilder@discus sions.microsoft .com> wrote in message
          news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=blue]
          > In my ASP.Net application I'm trying to contact a host that does not have
          > a
          > web service, i.e.: a file with the asmx extension such as, anything.asmx.
          >
          > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
          > I've been communicating with them using VB 6.0 method for a couple years
          > now
          > and I'd like to update my application to use .Net.
          >
          > Is there a way I can communicate with this service using .Net?
          >
          > Thanks,
          >
          > King Wilder[/color]


          Comment

          • K. Wilder

            #6
            Re: ServerXMLHTTP40 eqivalent...

            Yes, HTTPWebRequest did the trick. Thanks.

            "Stefan Misch" wrote:
            [color=blue]
            > HTTPWebRequest ?
            > See
            > http://msdn.microsoft.com/library/en...classtopic.asp
            > for more details
            >
            > Stefan
            >
            >
            > "K. Wilder" <KWilder@discus sions.microsoft .com> schrieb im Newsbeitrag
            > news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=green]
            > > In my ASP.Net application I'm trying to contact a host that does not have
            > > a
            > > web service, i.e.: a file with the asmx extension such as, anything.asmx.
            > >
            > > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
            > > I've been communicating with them using VB 6.0 method for a couple years
            > > now
            > > and I'd like to update my application to use .Net.
            > >
            > > Is there a way I can communicate with this service using .Net?
            > >
            > > Thanks,
            > >
            > > King Wilder[/color]
            >
            >
            >[/color]

            Comment

            • K. Wilder

              #7
              Re: ServerXMLHTTP40 eqivalent...

              Yes, HTTPWebRequest did the trick. Thanks.

              "Stefan Misch" wrote:
              [color=blue]
              > HTTPWebRequest ?
              > See
              > http://msdn.microsoft.com/library/en...classtopic.asp
              > for more details
              >
              > Stefan
              >
              >
              > "K. Wilder" <KWilder@discus sions.microsoft .com> schrieb im Newsbeitrag
              > news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=green]
              > > In my ASP.Net application I'm trying to contact a host that does not have
              > > a
              > > web service, i.e.: a file with the asmx extension such as, anything.asmx.
              > >
              > > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
              > > I've been communicating with them using VB 6.0 method for a couple years
              > > now
              > > and I'd like to update my application to use .Net.
              > >
              > > Is there a way I can communicate with this service using .Net?
              > >
              > > Thanks,
              > >
              > > King Wilder[/color]
              >
              >
              >[/color]

              Comment

              • Eugene Kosnyrev

                #8
                Re: ServerXMLHTTP40 eqivalent...


                Could you please provide a sample code how you use HttpWebRequest object
                instead of MSXML2.ServerXM LHTTP40?

                Thanks, Eugene.


                *** Sent via Developersdex http://www.developersdex.com ***

                Comment

                • Eugene Kosnyrev

                  #9
                  Re: ServerXMLHTTP40 eqivalent...


                  Could you please provide a sample code how you use HttpWebRequest object
                  instead of MSXML2.ServerXM LHTTP40?

                  Thanks, Eugene.


                  *** Sent via Developersdex http://www.developersdex.com ***

                  Comment

                  • K. Wilder

                    #10
                    Re: ServerXMLHTTP40 eqivalent...

                    Eugene,

                    I wrapped up the HTTP functions in a separate class.

                    I hope this helps.


                    ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

                    Imports System.Net
                    Imports System.IO
                    Imports System.Text

                    Public Class MasterPost

                    #Region "Public Functions"
                    Public Shared Function PostMessage(ByV al Message As String, ByVal URL As
                    String) As XmlNode

                    Try
                    '~~~ Set the data to send
                    Dim postData As String = Message
                    Dim encoding As New ASCIIEncoding
                    Dim byte1 As Byte() = encoding.GetByt es(postData)
                    Dim request As HttpWebRequest = CType(WebReques t.Create(URL),
                    HttpWebRequest)

                    '~~~ Set the Request properties and send the data.
                    request.Content Type = "text/xml"
                    request.Content Length = postData.Length
                    request.Method = "POST"
                    Dim newStream As Stream = request.GetRequ estStream()
                    newStream.Write (byte1, 0, byte1.Length)
                    newStream.Close ()

                    '~~~ Get the response.
                    Dim response As HttpWebResponse = CType(request.G etResponse(),
                    HttpWebResponse )
                    Dim recvStream As Stream = response.GetRes ponseStream()
                    Dim readStream As New StreamReader(re cvStream, encoding.UTF8)

                    Dim objXml As New XmlDocument
                    Dim objBody As XmlNode
                    Dim objRoot As XmlElement

                    objXml.XmlResol ver = Nothing
                    objXml.LoadXml( strXml)
                    objRoot = objXml.Document Element
                    objBody = objRoot.SelectS ingleNode("//AvailableRespon se")

                    Debug.WriteLine (objBody.OuterX ml)

                    Return objBody

                    objBody = Nothing
                    objXml = Nothing

                    response.Close( )
                    readStream.Clos e()
                    Catch ex As Exception
                    Return Nothing
                    Throw ex
                    End Try
                    End Function
                    #End Region
                    End Class


                    "Eugene Kosnyrev" wrote:
                    [color=blue]
                    >
                    > Could you please provide a sample code how you use HttpWebRequest object
                    > instead of MSXML2.ServerXM LHTTP40?
                    >
                    > Thanks, Eugene.
                    >
                    >
                    > *** Sent via Developersdex http://www.developersdex.com ***
                    >[/color]

                    Comment

                    • K. Wilder

                      #11
                      Re: ServerXMLHTTP40 eqivalent...

                      Eugene,

                      I wrapped up the HTTP functions in a separate class.

                      I hope this helps.


                      ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

                      Imports System.Net
                      Imports System.IO
                      Imports System.Text

                      Public Class MasterPost

                      #Region "Public Functions"
                      Public Shared Function PostMessage(ByV al Message As String, ByVal URL As
                      String) As XmlNode

                      Try
                      '~~~ Set the data to send
                      Dim postData As String = Message
                      Dim encoding As New ASCIIEncoding
                      Dim byte1 As Byte() = encoding.GetByt es(postData)
                      Dim request As HttpWebRequest = CType(WebReques t.Create(URL),
                      HttpWebRequest)

                      '~~~ Set the Request properties and send the data.
                      request.Content Type = "text/xml"
                      request.Content Length = postData.Length
                      request.Method = "POST"
                      Dim newStream As Stream = request.GetRequ estStream()
                      newStream.Write (byte1, 0, byte1.Length)
                      newStream.Close ()

                      '~~~ Get the response.
                      Dim response As HttpWebResponse = CType(request.G etResponse(),
                      HttpWebResponse )
                      Dim recvStream As Stream = response.GetRes ponseStream()
                      Dim readStream As New StreamReader(re cvStream, encoding.UTF8)

                      Dim objXml As New XmlDocument
                      Dim objBody As XmlNode
                      Dim objRoot As XmlElement

                      objXml.XmlResol ver = Nothing
                      objXml.LoadXml( strXml)
                      objRoot = objXml.Document Element
                      objBody = objRoot.SelectS ingleNode("//AvailableRespon se")

                      Debug.WriteLine (objBody.OuterX ml)

                      Return objBody

                      objBody = Nothing
                      objXml = Nothing

                      response.Close( )
                      readStream.Clos e()
                      Catch ex As Exception
                      Return Nothing
                      Throw ex
                      End Try
                      End Function
                      #End Region
                      End Class


                      "Eugene Kosnyrev" wrote:
                      [color=blue]
                      >
                      > Could you please provide a sample code how you use HttpWebRequest object
                      > instead of MSXML2.ServerXM LHTTP40?
                      >
                      > Thanks, Eugene.
                      >
                      >
                      > *** Sent via Developersdex http://www.developersdex.com ***
                      >[/color]

                      Comment

                      • K. Wilder

                        #12
                        Re: ServerXMLHTTP40 eqivalent...

                        Scott,

                        You are correct. I am using this object because I need to communicate with
                        a non-.Net web service.

                        King

                        "Scott M." wrote:
                        [color=blue]
                        > You'd want the HTTPWebRequest but you wouldn't be using it with an .asmx
                        > file since .asmx files are exclusively for .NET web services.
                        >
                        >
                        > "K. Wilder" <KWilder@discus sions.microsoft .com> wrote in message
                        > news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=green]
                        > > In my ASP.Net application I'm trying to contact a host that does not have
                        > > a
                        > > web service, i.e.: a file with the asmx extension such as, anything.asmx.
                        > >
                        > > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
                        > > I've been communicating with them using VB 6.0 method for a couple years
                        > > now
                        > > and I'd like to update my application to use .Net.
                        > >
                        > > Is there a way I can communicate with this service using .Net?
                        > >
                        > > Thanks,
                        > >
                        > > King Wilder[/color]
                        >
                        >
                        >[/color]

                        Comment

                        • K. Wilder

                          #13
                          Re: ServerXMLHTTP40 eqivalent...

                          Scott,

                          You are correct. I am using this object because I need to communicate with
                          a non-.Net web service.

                          King

                          "Scott M." wrote:
                          [color=blue]
                          > You'd want the HTTPWebRequest but you wouldn't be using it with an .asmx
                          > file since .asmx files are exclusively for .NET web services.
                          >
                          >
                          > "K. Wilder" <KWilder@discus sions.microsoft .com> wrote in message
                          > news:5F15DD85-01E5-4770-8062-CF95242D6EE4@mi crosoft.com...[color=green]
                          > > In my ASP.Net application I'm trying to contact a host that does not have
                          > > a
                          > > web service, i.e.: a file with the asmx extension such as, anything.asmx.
                          > >
                          > > They do have an URL to be contacted by VB 6.0 ServerXMLHTTP40 Send method.
                          > > I've been communicating with them using VB 6.0 method for a couple years
                          > > now
                          > > and I'd like to update my application to use .Net.
                          > >
                          > > Is there a way I can communicate with this service using .Net?
                          > >
                          > > Thanks,
                          > >
                          > > King Wilder[/color]
                          >
                          >
                          >[/color]

                          Comment

                          Working...