Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling web service from VB6 application

Status
Not open for further replies.

kathymo

Programmer
May 23, 2000
2
US
I need to add a call to a web service to a VB6 application. The web service requires separate authentication into the server as well as the service itself. When I run the code that makes the call, I receive the following internal server error:
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. ---&gt;
Username is invalid.</faultstring>
<detail />
</soap:Fault>


Below is my code:

Dim o As New MSXML2.XMLHTTP
Dim OBJDOM As New MSXML2.DOMDocument
Dim s As String
Dim strUNPass As String

s = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="" & _
"<soap:Header>" & _
"<UserAuth xmlns="" & _
"<Username>""SVCUSRNAM""</Username>" & _
"<Password>""SVCPSW""</Password>" & _
"</UserAuth>" & _
"</soap:Header>" & _
"<soap:Body>" & _
"<GetForms xmlns="" & _
"<formParms>" & _
"<State>""CA""</State>" & _
"<Age>44</Age>" & _
"<Amount>125000</Amount>" & _
"</formParms>" & _
"</GetForms>" & _
"</soap:Body>" & _
"</soap:Envelope>"

OBJDOM.async = False
OBJDOM.loadXML s

o_Open "POST", " False, "SRVUSER", "SRVPW"
o.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
o.setRequestHeader "SOAPAction", "
‘*** Code used in previous attempts
'o.setRequestHeader "Authorization", "Basic " & Encode64("SVCUSRNAM" & ":" & "SVCPSW")
'o.setRequestHeader "Authorization", "Basic " & ("SVCUSRNAM" & ":" & "SVCPSW")
‘***

o.send OBJDOM.xml

Debug.Print o.responseText

‘*** END OF CODE


My guess is that the authentication for the service (in the soap header) is generating the error. I have tried additional code (which is commented out above in the code) to set up an Authorization setRequestHeader, but attempts have not worked.

Any thoughts on how I can fix or debug this?
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top