Hi,
I'm getting StatusCode: 200, but it is not reflecting on server.
Following is my code:
String gsPMUsername="abcde";
String gsPMPassword ="password";
String lourl = "/association/property/ 4332056/meter";
String lodata = "<meterPropertyAssociationList>
<energyMeterAssociation>
<meters>
<meterId>11718108</meterId>
</meters>
<propertyRepresentation>
<propertyRepresentationType>Whole Property</propertyRepresentationType>
</propertyRepresentation>
</energyMeterAssociation>
</meterPropertyAssociationList>";
HttpClient goclient = new HttpClient();
goclient.BaseAddress = new Uri("https://portfoliomanager.energystar.gov/ws/");
Byte[] lbbuffer = Encoding.ASCII.GetBytes(string.Concat(gsPMUsername, ":", gsPMPassword));
AuthenticationHeaderValue loAuthHeader = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(lbbuffer));
goclient.DefaultRequestHeaders.Authorization = loAuthHeader;
goclient.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/xml"));
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, lourl);
req.Content = new StringContent(lodata, Encoding.UTF8, "application/xml");
var response = goclient.SendAsync(req, HttpCompletionOption.ResponseContentRead).Result;
I'm getting following reponse:
StatusCode: 200, ReasonPhrase:
{
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Vary: Cookie
X-UA-Compatible: IE=Edge,chrome=1
Link: <http://www.energystar.gov/buildings/facility-owners-and-managers/existing-buildings/use-portfolio-manager>; rel="canonical",<http://www.energystar.gov/node/14475>; rel="shortlink"
Cache-Control: public, max-age=0
Date: Fri, 20 Feb 2015 12:19:07 GMT
ETag: "1423570746-0"
Server: nginx
Content-Language: en
Content-Type: text/html; charset=utf-8
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Fri, 20 Feb 2015 12:19:06 GMT
}