[英]How to send HTTP POST request which is of type “text/xml”
I want to send the HTTP POST request which is of type "text/xml" Along with the request I am sending the Querystring value as : 我想发送类型为“text / xml”的HTTP POST请求以及我发送Querystring值的请求:
"?wicket:interface=:9:XXOIForm:transactionForm:componentListPanel:componentListView:0:component:expressEntryContainer:expressEntry::IBehaviorListener:0:&wicket:pcxt=XXOIForm&random=0.48316250719134435"
Here are the few request headers I am adding manually 以下是我手动添加的几个请求标头
request.Headers.Add("Accept-Language", "en-us,en;q=0.5");
request.Headers.Add("Wicket-Ajax", "true");
request.Headers.Add("Wicket-FocusedElementId", "id1a");
This all log I logged through the HTTP Anlayzer tool. 这是我通过HTTP Anlayzer工具记录的所有日志。
But I am not able to bypass this request. 但我无法绕过这个请求。 Please suggest me Is there is any way to send the HTTP POST request which is of type "text/xml"
? 请建议我有没有办法发送类型为"text/xml"
的HTTP POST请求?
Or What I need to send in request headers? 或者我需要在请求标头中发送什么?
Yes I am sending the post data in Byte Stream format only See I am having following code to send post data 是的我只发送字节流格式的发布数据请参阅我有以下代码发送发布数据
protected void WritePostDataToRequest(string postData)
{
postData = postData.Replace("/", "%2F").Replace(",", "%2C").Replace(" ", "+").Replace("!", "%21").Replace("#", "%23");
data = encoding.GetBytes(postData);
request.ContentLength = data.Length;
newStream = request.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
}
Also I already added the request header content type. 我还添加了请求标头内容类型。
Thanks in Advance... 提前致谢...
request.ContentType = 'text/xml';
use byte stream to send ur data: 使用字节流来发送你的数据:
string data="wicket:interface=:9:eligibitiyBenefitsInquiryForm:transactionForm:componentListPanel:componentListView:0:component:expressEntryContainer:expressEntry::IBehaviorListener:0:&wicket:pcxt=EligibilityBenefitInquiryPage&random=0.48316250719134435"
byte[] dataStream = Encoding.UTF8.GetBytes(data);
string uriStr = "www.abc.com";
HttpWebRequest rqst = (HttpWebRequest)HttpWebRequest.Create(Uri.EscapeUriString(uriStr));
rqst.KeepAlive = false;
rqst.Method = "POST";
rqst.ContentType = "application/x-www-form-urlencoded";
rqst.ContentLength = dataStream.Length;
Stream newStream = rqst.GetRequestStream();
newStream.Write(dataStream, 0, dataStream.Length);
newStream.Close();
WebResponse resp = rqst.GetResponse();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.