T
tbergman
Guest
For adding headers and setting content-type it's best to use the httpRequestMessage when using HttpClient. The code below shows another usage where headers anhd content type are set. Content-type is not an ordinary header like SOAPAction below. It needs to be done as a part of setting the content. The Uri should be just what you'd type in a browser, no href. httpClient = NEW System.Net.Http.HttpClient(). httpRequestMessage = NEW System.Net.Http.HttpRequestMessage(). httpRequestMessage:Method = System.Net.Http.HttpMethod
ost. httpRequestMessage:RequestUri = NEW System.Uri(vUrl). httpRequestMessage:Content = NEW System.Net.Http.StringContent(xmlRequest, System.Text.Encoding:UTF8, "text/xml"). httpRequestMessage:Headers:Add ("SOAPAction","~"~""). /* Use SendAsync in a synchronous manner by directly accessing the result */ httpResponseMessage = httpClient:SendAsync(httpRequestMessage):Result. xmlResponse = httpResponseMessage:Content:ReadAsStringAsync():RESULT NO-ERROR.
Continue reading...
Continue reading...