How can I call a SOAP 1.2 Web service from a LotusScript agent?

倖福魔咒の 提交于 2019-12-01 11:38:52

问题


I'm using a Lotus Domino 9 on a windows Server

I must call a Soap 1.2 web service that is not maintained anymore

The Lotus Web service consumers only accepts Soap 1.1 web services, So I cannot use this nice feature to bind my web services.

Is it possible to call a Soap 1.2 web service from my LotusScript agent and if yes, what are the needed steps ?


回答1:


Finally I found a solution using the XMLHTTP object

Sub Initialize
    Dim xmlhttp As Variant
    dim DOMDocument As Variant
    Dim soapEnvelope As String
    Dim webService As String
    dim username As String
    Dim password As String
    Dim strxml As String

    Set xmlhttp = CreateObject("Msxml2.XMLHTTP")
    Set DOMDocument = CreateObject("MSXML2.DOMDocument")

    webService = "http://server/path/service"

    username = "user1"
    password = "123456"

    soapEnvelope ={<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:doc="http://checkYourOwnEnvelopeDetails.com">}
    soapEnvelope =soapEnvelope & {<soap:Header/>}
    soapEnvelope =soapEnvelope & {<soap:Body>}

    ' ...use SoapUI to know the exact envelop structure

    soapEnvelope =soapEnvelope & {</soap:Body>}
    soapEnvelope =soapEnvelope & {</soap:Envelope>}

    DOMDocument.loadXML (soapEnvelope)

    Call xmlhttp.open("POST", webService, False,username,password)
    Call xmlhttp.setRequestHeader("Content-Type", "application/soap+xml;charset=UTF-8")
    Call xmlhttp.setRequestHeader("Username", username)
    Call xmlhttp.setRequestHeader("Password", password)

    ' again, use SoapUI to discover the exact name of the action
    Call xmlhttp.setRequestHeader("SOAPAction", "urn:getListAll")
    Call xmlhttp.send(DOMDocument.xml)
    strxml = xmlhttp.responseText

    ...    
End Sub


来源:https://stackoverflow.com/questions/28580457/how-can-i-call-a-soap-1-2-web-service-from-a-lotusscript-agent

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