Answer the question
In order to leave comments, you need to log in
How to create a COM object and call its methods in NSIS?
I use SOAP toolkit to access the web service, which is convenient because there is a COM interface.
The scheme is as follows:
1. I run the SoapClient.vbs script, pass it the contents of the request in the $tempFile file and the $queryMethod' conditional method.
nsExec::ExecToStack '$0\cscript.exe //NOLOGO $\"$TEMP\SoapClient.vbs$\" $tempFile $queryMethod'
Dim resp
Set objArgs= Wscript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(objArgs(0), 1, False, -1)
content = file.ReadAll
file.Close
Set soapclient = CreateObject ("MSSOAP.SoapClient30")
SOAPClient.mssoapinit ("http://localhost:80/service?wsdl")
If objArgs(1) = "getLic" Then
resp = SOAPClient.GetLic(content)
ElseIf objArgs(1) = "setLic" Then
resp = SOAPClient.SetLic(content)
End If
Set soapclient = Nothing
Set file = fso.OpenTextFile(objArgs(0), 2, False, -1)
file.WriteLine(resp)
file.Close
!define IID_StdOle '{00020430-0000-0000-C000-000000000046}'
!define IID_IDispatch '{00020400-0000-0000-C000-000000000046}'
!define IID_IUnknown '{00000000-0000-0000-C000-000000000046}'
!define IID_NULL '{00000000-0000-0000-0000-000000000000}'
!define CLSCTX_SERVER 0x015
!define LOCALE_SYSTEM_DEFAULT 0x800
Section
DetailPrint "== CLSIDFromProgID =="
System::Call `Ole32::CLSIDFromProgID(w,&g16)i ("MSSOAP.SoapClient30",.r0).r2`
DetailPrint "== CoCreateInstance =="
System::Call `Ole32::CoCreateInstance(g r0,i 0,i ${CLSCTX_SERVER},g '${IID_IDispatch}',*i .r1) i .r2`
DetailPrint "== IDispatch::GetTypeInfoCount =="
System::Call `$1->3(*i .r3)i .r2`
DetailPrint "== IDispatch::GetTypeInfo =="
System::Call `$1->4(i 0,i ${LOCALE_SYSTEM_DEFAULT},*g .r3)i .r2`
DetailPrint "== Oleaut32::SysAllocString =="
System::Call `Oleaut32::SysAllocString(w "mssoapinit")i .r4`
DetailPrint "== IDispatch::GetIDsOfNames =="
System::Call `$1->5(g ${IID_NULL},*i r4,i 1,i ${LOCALE_SYSTEM_DEFAULT},*i .r3)i .r2`
DetailPrint "== mssoapinit =="
System::Call `$1->1(w "http://localhost:80/service?wsdl")t .r2`
DetailPrint "== Oleaut32::SysFreeString =="
System::Call `Oleaut32::SysFreeString(*i r4)`
DetailPrint "== IUnknown::Release =="
System::Call `$1->2()i .r2`
DetailPrint " RefCount=$2"
SectionEnd
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question