XML 文字列データをリモート WCF サービスに投稿し、結果を抽出するかなり標準的な機能があります。正常に動作しますが、「大量」のデータ (この場合は 138KB) にスケーリングできません。
' performs a HTTP POST and returns the resulting message content
Function HttpPost(sUrl As String, sSOAPAction As String, sContent As String) As String
Dim oHttp As Object
'Set oHttp = CreateObject("Microsoft.XMLHTTP")
Set oHttp = CreateObject("MSXML2.XMLHTTP.6.0")
oHttp.open "POST", sUrl, False
oHttp.setRequestHeader "SOAPAction", """http://conducive.com.au/IXpacManagement/" & sSOAPAction & """"
oHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
oHttp.setRequestHeader "Content-Length", Len(sContent)
oHttp.send Str(sContent)
If oHttp.status = 200 Then
HttpPost = oHttp.responseText
Else
MsgBox "An error (" & LTrim(Str(oHttp.status)) & ") has occurred connecting to the server."
HttpPost = ""
End If
Set oHttp = Nothing
End Function
使用するMicrosoft.XMLHTTPと が得られerror 7 out of memoryます。
使用するMSXML2.XMLHTTP.6.0と が得られobject doesn't support this property or methodます。
いずれの場合も、1,000 文字未満の小さな文字列を送信するだけで問題なく動作します。
文字列を送信するさまざまな方法を試してみると、次のようになります。
- 使用
oHttp.send(sContent): 小さな POST でさえ失敗しInvalid procedure call or argument Runtime error 5ます。 - 使用
oHttp.send sContent: 小さな POST でさえ失敗しInvalid procedure call or argument Runtime error 5ます。
結局oHttp.send CStr(sContent)働いた。私が迷っていたので、すべての提案に感謝します。