入力xmlをメッセージ本文として送信する必要がある場合は、次の方法で送信できます。リクエストヘッダーを追加または変更して、機能させる必要がある場合があります。
DOMDocumentオブジェクトを使用すると、xmlドキュメントを簡単に操作できます。
にプロジェクト参照を追加します。
- Microsoft WinHTTP Services、バージョン5.1
- Microsoft XML、v6.0
例:
Dim xmlInput As String
xmlInput = "<YourXmlRequest></YourXmlPayload>"
Dim oXmlHttp As MSXML2.XMLHTTP60
Set oXmlHttp = New MSXML2.XMLHTTP60
oXmlHttp.Open "POST", serviceURL, False, "UserName", "Password"
oXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXmlHttp.setRequestHeader "Connection", "Keep-Alive"
oXmlHttp.setRequestHeader "Accept-Language", "en"
oXmlHttp.send xmlInput
Debug.Print oXmlHttp.responseText
Dim oXmlReturn As MSXML2.DOMDocument60
Set oXmlReturn = New MSXML2.DOMDocument60
oXmlReturn.loadXML oXmlHttp.responseText