473,410 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Problem calling webservice from VB6

Hi, i'm new at the forum and vb as well

I'm having a problem to instatiate a webservice in VB6.
I have to call a webservice in a app that were bilt in VB6, but i'm trying to use some examples to get more experience before i implement the solution.

i've tryed to folow this examples: http://www.freevbcod...ode.asp?ID=7611
and use this two webservices to try my code: http://ws.cdyne.com/...ityWeatherByZIP
http://www.webservic...ils.aspx?SID=48

Right now i'm trying to access to the webservice using the XML, i've tryed with soap too but i've got no sucess
my code at this time looks like this:

Expand|Select|Wrap|Line Numbers
  1. Public Function ValidaWS_aux7(Par1 As String, Par2 As String) As Boolean
  2.     Dim strSoapAction As String
  3.     Dim strUrl As String
  4.     Dim strXml As String
  5.     Dim strParam As String
  6.     Dim objDom As Object
  7.     Dim objXmlHttp As Object
  8.     Dim strRet As String
  9.     Dim intPos1 As Integer
  10.     Dim intPos2 As Integer
  11.  
  12.  
  13.     strUrl = "http://www.webservicex.net/globalweather.asmx?wsdl"
  14.     strSoapAction = "http://www.webserviceX.NET/GetCitiesByCountry"
  15.  
  16.     strXml = "<?xml version=""1.0"" encoding=""utf-8""?> " & _
  17.                 "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope""> " & _
  18.                     "<soap12:Body> " & _
  19.                         "<GetCitiesByCountry xmlns=""http://www.webserviceX.NET""> " & _
  20.                             "<CountryName>Portugal</CountryName> " & _
  21.                         "</GetCitiesByCountry> " & _
  22.                     "</soap12:Body> " & _
  23.                 "</soap12:Envelope> "
  24.  
  25.     ' Create objects to DOMDocument and XMLHTTP
  26.     Set objDom = CreateObject("MSXML2.DOMDocument")
  27.     Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")
  28.  
  29.     ' Load XML
  30.     objDom.async = False
  31.     objDom.LoadXml XmlBody
  32.  
  33.     ' Open the webservice
  34.     objXmlHttp.open "POST", strUrl, False
  35.  
  36.     ' Create headings
  37.     objXmlHttp.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
  38.     objXmlHttp.setRequestHeader "SOAPAction", SoapActionUrl
  39.     objXmlHttp.setRequestHeader "Content-Length", 10000
  40.     ' Send XML command
  41.     objXmlHttp.send objDom.xml
  42.  
  43.     ' Get all response text from webservice
  44.     strRet = objXmlHttp.responseText
  45.     ' Close object
  46.     Set objXmlHttp = Nothing
  47.  
  48.     MsgBox "" & strRet
  49.  
  50. Exit Function
  51. Err_PW:
  52.     PostWebservice = "Error: " & Err.Number & " - " & Err.Description
  53.  
  54. End Function
my problem is that the variable strRet comes whith the following error: Root element is missing.

Someone can give me a help on this? or point some tutorial to build XML/SOAP to call an webservice?

thanks in advance
Aug 18 '10 #1
0 1091

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Daniel Diehl | last post by:
Good morning! Now I'm sitting over 2 hours on a problem calling a method in the logitech SDK DLL. Everything is working fine, but calling one method I fell in a problem. I'm not that old with C#...
0
by: Tako | last post by:
I have a problem calling .NET classes with default properties from VB6. The class has a public member, this public member has a default property, from VB6 I can´t acces the default method without...
0
by: Det | last post by:
Hi there I am somewhat stuck with calling a WebService from out of a VB App. My Goal: - Get a WebService invoked under MS - Access 2002, not using the MS-SOAP-Toolkit but the .net - Framework ...
3
by: Merav Orion via .NET 247 | last post by:
I have a problem calling webservice from client side javascript. The javascript call the settimeout() method. when the user press submit button it ignore the press and keep refreshing the page. it...
1
by: Smugsboy | last post by:
Hi, I have a problem with a web service proxy written in .NET and used from VS6's C++ as COM object. This proxy works great when used from a .NET application. It does not seem to work when used...
3
by: Henrik | last post by:
Hi all,,, I need to get a refferece to a XML-webservice, and get some data from it.... But I can't add it like an web-refference... What options does I else have?? I've been told that i've to...
1
by: Steve Lutz | last post by:
I have written a web service to provide some back-end functionality to a Web Site. The web service returns lists of items. If I use the webservice via a browser, it works fine and returns the...
0
by: Jitesh | last post by:
I am facing a problem in webservice, I want to know what will be the exact procedure to solve the problem............. What I want to do............ I have a table named order in SQL Server....
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
0
by: BornTOCode | last post by:
Hello, I am attempting to call a (Delphi) win32 DLL from a Delphi.Net webservice. I am using a slightly modified version of the hello world webservice that comes with Delphi 2006. The DLL...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.