views:

122

answers:

0

I am trying to Execute the below services using System.Web.Client and I passed the SAOP message in this format. but when I say Upload String it gives me error

Error: Exception calling "UploadString" with "2" argument(s): "The remote server returned an error: (500) Internal Server Error." At :line:28 char:46 + (new-object System.Net.WebClient).UploadString <<<< ($Url1, $saopMessage)

Power shell Code:

$Url = "http://www.webservicex.net/WeatherForecast.asmx"

$webclient = new-object System.Net.WebClient
#$webclient.Credentials = new-object System.Net.NetworkCredential($username, $path, $domain)
#$webpage = $webclient.DownloadString($url)
#$webpage | Write-Host

$Url1 =  "http://www.webservicex.net/WeatherForecast.asmx/GetWeatherByPlaceName"

$saopMessage = @"
<?xml version = "1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
<soap:Body>
<GetWeatherByPlaceName xmlns ="http://www.webservicex.net" >
<PlaceName>New York</PlaceName>
</GetWeatherByPlaceName>
</soap:Body>
</soap:Envelope>
"@
#$webclient.headers.Add("SOAPAction", `
#                "http://www.webservicex.net/GetWeatherByPlaceName")
#    $webclient.headers.Add("Content-Type", "text/xml; charset=utf-8")

$webclient.UploadString($Url1, $saopMessage)

Am I missing Some thing.

Thanks, Kiran K