Powerbuilder call WebService with BasicAuthentication

天大地大妈咪最大 提交于 2019-12-13 03:23:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!