问题
I am using PB 11.5.1 (Classic) and I want to pass an XML to a WebService that uses BasicAuth.
I cannot find how to implement the BasicAuth.
I have searched forums/blogs but I found no clear answer if it is even possible.
Any help appreciated
回答1:
Perhaps you can use an oleobject
which uses MSXML.ServerXMLHTTP
:
// args: as_username, as_password, as_basicauthstring
oleobject lole_http
string ls_response
lole_http = create oleobject
lole_http.ConnectToNewObject("msxml2.ServerXMLHTTP")
lole_http.Open("POST", ls_theurl, FALSE, as_username, as_password)
lole_http.setTimeouts 5000, 5000, 10000, 10000 //ms - resolve, connect, send, receive
lole_http.setRequestHeader("Authorization", "Basic " + as_basicauthstring) // set your basic auth string here
lole_http.Send(xmlToSend)
ls_response = lole_http.responseText
lole_http.DisconnectObject()
来源:https://stackoverflow.com/questions/52756560/powerbuilder-call-webservice-with-basicauthentication