我需要从我的VB6程序中使用外部Web服务.如果可能,我希望能够部署我没有SOAP工具包的程序,但这不是必需的.我没有Web服务源,我没有创建它.它是供应商提供的服务.
所以在SOAP工具包之外,从VB6消费Web服务的最好方法是什么?
解决方法
我使用此功能从Web服务获取数据.
- Private Function HttpGetRequest(url As String) As DOMDocument
- Dim req As XMLHTTP60
- Set req = New XMLHTTP60
- req.Open "GET",url,False
- req.send ""
- Dim resp As DOMDocument
- If req.responseText <> vbNullString Then
- Set resp = New DOMDocument60
- resp.loadXML req.responseText
- Else
- Set resp = req.responseXML
- End If
- Set HttpGetRequest = resp
- End Function