VB6 Soap

I have been tasked with creating a web services call through a VB6 application. I've added the SOAP 3.0 Toolkit and have the code below.

I'm trying to hit the FedEx web service. I've tried changing the init to FedEx, and I get error messages.
"WSDLReader:XML Parser failed at linenumber 0, lineposition 0, reason is: System error: -2146697210.
 HRESULT=0x1: Incorrect function.
 - WSDLReader:Loading of the WSDL file failed HRESULT=0x80070057: The parameter is incorrect.
 - Client:One of the parameters supplied is invalid. HRESULT=0x80070057: The parameter is incorrect."

I'm at a loss as to how I insert values into the call, I have the Request XML file and I know what I should be putting in there, but no idea how to actually send the correct information.

I've done web services development in .NET but that's not an option with this project.
Private Sub Command1_Click()
On Error GoTo error_Occured
Dim client
Set client = CreateObject("MSSOAP.SoapClient30")
client.mssoapinit "http://localhost/CF_WebSvc/justFunction.cfc?wsdl"

strg = (client.WelcomeMsg(Text1.Text))
MsgBox (strg)

Exit Sub

If Err.Number = -2147024809 Then
    MsgBox "Invalid Web Service Request. Please check the Web Service URL"
End If
GoTo exit_Function

End Sub

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Set a reference to the Microsoft xml dll and try this code:

Sub soapDemo()

    Dim sURL As String
    Dim strXML As String
    Dim sEnv As String
    Dim xmlhtp As New MSXML2.XMLHTTP40
    Dim xmlDoc As New DOMDocument
    sURL = "http://webservices.gama-system.com/exchangerates.asmx?op=ConvertToForeign"
    sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>"
    sEnv = sEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
    sEnv = sEnv & "  <soap:Body>"
    sEnv = sEnv & "    <ConvertToEUR xmlns=""http://www.gama-system.com/webservices"">"
    sEnv = sEnv & "      <dcmValue>decimal</dcmValue>"
    sEnv = sEnv & "      <strBank>ING</strBank>"
    sEnv = sEnv & "      <strCurrency>USD</strCurrency>"
    sEnv = sEnv & "      <strDate>31-1-2008</strDate>"
    sEnv = sEnv & "      <intRank>1</intRank>"
    sEnv = sEnv & "    </ConvertToEUR>"
    sEnv = sEnv & "  </soap:Body>"
    sEnv = sEnv & "</soap:Envelope>"
    With xmlhtp
        .Open "post", sURL, False
        .setRequestHeader "Host", "webservices.gama-system.com"
        .setRequestHeader "Content-Type", "text/xml; charset=utf-8"
        .setRequestHeader "soapAction", "http://www.gama-system.com/webservices/ConvertToForeign"
        .setRequestHeader "Accept-encoding", "zip"
        .send sEnv
        ' Next statement strips off the soap envelope and creates an XML document with just the results.
        xmlDoc.loadXML .responseText
        MsgBox .responseText
    End With
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
And of course you need to build the proper envelope string which belongs to the webservice you are trying to address....
whsrptgAuthor Commented:
Is IIS required on all machines that run this, or just the server?
whsrptgAuthor Commented:
NM, It's only required on the server. thanks for your help that'll work out great!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.