各位前輩好,小弟有幾個問題求教版上各位前輩
1. 在VB6的Binary陣列該如何透過webservice(以C#撰寫)方式傳遞檔案到Server端呢?
此webservice以.NET程式進行傳檔是OK的,
傳遞的參數為(string FileName, Byte[] FileContent)
但在VB6時,會發生傳遞參數格式不正確的錯誤,
猜想是Binary陣列被轉成字串了,但不知該如何修改,還盼各位指教
VB6的程式片段如下
=======================================================================
> //呼叫webservice
Set wsObj = CreateObject("Msxml2.XMLHTTP")
Call wsObj.Open("POST", "Service 連結/含式名稱", False)
Call wsObj.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded")
Call wsObj.send("FileName=檔案名稱&FileContent=" & GetFile("檔案名稱"))
> //取得檔案Binary陣列
Function GetFile(strFileName As String)
Dim bytFile() As Byte
nfile = FreeFile
Open strFileName For Binary As #nfile
ReDim bytFile(LOF(nfile) - 1)
Get #nfile, , bytFile
Close #nfile
GetFile2 = bytFile
End Function
======================================================================
2. VB6是否能夠引用.NET開發的dll?
這問題算是繞彎子想避開問題一的解法所遭遇的另一個問題,
想說另外以.net寫一個dll負責呼叫webservice的檔案傳遞,
但產生出來的dll卻無法被VB6引用 Orz
是否在.NET產生dll需做額外的設定才能被VB6引用呢?
謝謝各位的指導囉~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.250.192.34