Hi,
I'm trying to do an xml post on a webservice. But i think i'm doing something wrong with the XML string. It seems to expect an integer. Does anybody have a tip to get this post working? Please explain me what i'm doing wrong.
function sendXML{
$url = "http://gateway/gateway.ashx"
$parameters = '<?xml version="1.0" encoding="utf-8"?>' + "'n" + '<MESSAGES>' + "'n" + '<CUSTOMER ID="test" />' + "'n" + '<USER LOGIN="test" PASSWORD="test" />' + "'n" + '<REFERENCE>"Standby"</REFERENCE>' + "'n" + '<MSG>' + "'n" + '<FROM>"System Center Operations Manager R2"</FROM>' + "'n" + '<DCS>8</DCS>' + "'n" + '<TO>"Standby"</TO>' + "'n" + '<BODY TYPE="String" HEADER="Test_ID">Test</BODY>' + "'n" + '<TO OPERATOR="Standby">"telephone"</TO>' + "'n" + '</MSG>' + "`n"+ '</MESSAGES>'
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open('POST', $url, $false)
$http_request.setRequestHeader("Content-type", "text/html")
$http_request.setRequestHeader("Content-length", $parameters.length)
$http_request.setRequestHeader("Connection", "close")
$http_request.send($parameters)
$http_request.statusText
$http_request.responseText
}
sendXMLKind regards,
André