Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Post xml on a webservice

$
0
0

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
 }
 sendXML

Kind regards,

André



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>