本文介绍了添加一个身体正在与湛蓝的服务MGMT API使用的HttpWebRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何去增加身体一HttpWebRequest的?
人体需要作出高达以下
<?XML版本=1.0编码=UTF-8&GT?;
< ChangeConfiguration的xmlns =http://schemas.microsoft.com/windowsazure>
<结构>基地-64-CN codeD-配置文件< /结构>
< TreatWarningsAsError>真|虚假< / TreatWarningsAsError>
<模式>自动|手动< /模式>
< / ChangeConfiguration>
任何帮助很多AP preciated
解决方案
字节[] buf中= Encoding.UTF8.GetBytes(XML);request.Method =POST;
request.ContentType =文/ XML;
request.ContentLength = buf.Length;
。request.GetRequestStream()收件(BUF,0,buf.Length);变种HttpWebResponse =(HttpWebResponse)request.GetResponse();
How would i go about adding to the body of a HttpWebRequest?
The body needs to be made up of the following
<?xml version="1.0" encoding="utf-8"?>
<ChangeConfiguration xmlns="http://schemas.microsoft.com/windowsazure">
<Configuration>base-64-encoded-configuration-file</Configuration>
<TreatWarningsAsError>true|false</TreatWarningsAsError>
<Mode>Auto|Manual</Mode>
</ChangeConfiguration>
Any help is much appreciated
解决方案
byte[] buf = Encoding.UTF8.GetBytes(xml);
request.Method = "POST";
request.ContentType = "text/xml";
request.ContentLength = buf.Length;
request.GetRequestStream().Write(buf, 0, buf.Length);
var HttpWebResponse = (HttpWebResponse)request.GetResponse();
这篇关于添加一个身体正在与湛蓝的服务MGMT API使用的HttpWebRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!