It seems like ASP.NET WebMethods are not "web servicey" enough to work with New-WebServiceProxy
. Or maybe it is, and I haven't figured out how to initialize it?
So instead, I tried doing it manually, like so:
$wc = new-object System.Net.WebClient
$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$url = "http://www.domenicdenicola.com/AboutMe/SleepLog/default.aspx/GetSpans"
$postData = "{`"starting`":`"\/Date(1254121200000)\/`",`"ending`":`"\/Date(1270018800000)\/`"}"
$result = $wc.UploadString($url, $postData)
But this gives me "The remote server returned an error: (500) Internal Server Error." So I must be doing something slightly wrong.
Any ideas on how to call my PageMethod
from PowerShell, and not get an error?