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. --->
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
pen "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!
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. --->
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.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!