Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Calling Web Service using VB6 without SOAP

Calling Web Service using VB6 without SOAP

Scheduled Pinned Locked Moved Visual Basic
xmlwcfhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kumaran21cen
    wrote on last edited by
    #1

    Iam using HTTP to call web service without SOAP. It gives Error: 500" Please anyone tell whats the error. Actually its status is not 200. Is there any other method to call webservice using vb6 without SOAP? Here is my code below: Public Function Run_WebService(ByRef InForm As Form, ByVal CaseNo As Integer) As Boolean On Error GoTo Catch Dim IsOk As Boolean Dim StrResults As String Dim ObjXMLHTTP As Object Dim ObjXMLDOM As Object Const WebSite As String = "http://localhost/MyService/MyWebService.asmx/" Dim iPos As Long, jPos As Long Dim MakeParameters As String IsOk = False Set ObjXMLHTTP = CreateObject("Microsoft.XMLHTTP") Set ObjXMLDOM = CreateObject("Microsoft.XMLDOM") Select Case CaseNo Case 1 With ObjXMLHTTP .Open "GET", WebSite & "MyProduct?ID=5" , False ', "sa", "password" .Send DoEvents If .Status = 200 Then 'is ok 'Load the XML document from the webservice ObjXMLDOM.loadXML .ResponseText 'check if there are any errors If ObjXMLDOM.parseError.ErrorCode <> 0 Then MsgBox .ResponseText IsOk = False Else 'Get the results StrResults = ObjXMLDOM.GetElementsByTagName("string").Item(0).Text 'iPos = InStr(1, StrResults, "<code>", vbTextCompare) 'iPos = iPos + Len("<code>") 'jPos = InStr(1, StrResults, "</code>", vbTextCompare) 'If Val(jPos) = 0 Then ' StrResults = "Invalid Country." 'Else ' StrResults = Mid$(StrResults, iPos, jPos - iPos) 'End If 'InForm.txtResults(0).Text = StrResults IsOk = True End If Else MsgBox "ERROR - " & .Status, vbCritical, "ERROR" IsOk = False End If End With End Select ExitFunction: Set ObjXMLHTTP = Nothing Set ObjXMLDOM = Nothing StrResults = vbNullString Run_WebService

    D 1 Reply Last reply
    0
    • K Kumaran21cen

      Iam using HTTP to call web service without SOAP. It gives Error: 500" Please anyone tell whats the error. Actually its status is not 200. Is there any other method to call webservice using vb6 without SOAP? Here is my code below: Public Function Run_WebService(ByRef InForm As Form, ByVal CaseNo As Integer) As Boolean On Error GoTo Catch Dim IsOk As Boolean Dim StrResults As String Dim ObjXMLHTTP As Object Dim ObjXMLDOM As Object Const WebSite As String = "http://localhost/MyService/MyWebService.asmx/" Dim iPos As Long, jPos As Long Dim MakeParameters As String IsOk = False Set ObjXMLHTTP = CreateObject("Microsoft.XMLHTTP") Set ObjXMLDOM = CreateObject("Microsoft.XMLDOM") Select Case CaseNo Case 1 With ObjXMLHTTP .Open "GET", WebSite & "MyProduct?ID=5" , False ', "sa", "password" .Send DoEvents If .Status = 200 Then 'is ok 'Load the XML document from the webservice ObjXMLDOM.loadXML .ResponseText 'check if there are any errors If ObjXMLDOM.parseError.ErrorCode <> 0 Then MsgBox .ResponseText IsOk = False Else 'Get the results StrResults = ObjXMLDOM.GetElementsByTagName("string").Item(0).Text 'iPos = InStr(1, StrResults, "<code>", vbTextCompare) 'iPos = iPos + Len("<code>") 'jPos = InStr(1, StrResults, "</code>", vbTextCompare) 'If Val(jPos) = 0 Then ' StrResults = "Invalid Country." 'Else ' StrResults = Mid$(StrResults, iPos, jPos - iPos) 'End If 'InForm.txtResults(0).Text = StrResults IsOk = True End If Else MsgBox "ERROR - " & .Status, vbCritical, "ERROR" IsOk = False End If End With End Select ExitFunction: Set ObjXMLHTTP = Nothing Set ObjXMLDOM = Nothing StrResults = vbNullString Run_WebService

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Calling a Web Service using VB6 with SOAP 3.0[^] Calling Web Services from Visual Basic 6, the Easy Way[^] Or you could build the HTTP request string yourself, then parse the response yourself, though this is FAR from being a trivial task.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups