使用httpwebresponse在SOAP响应中获取标头 [英] Getting header in SOAP response with httpwebresponse
本文介绍了使用httpwebresponse在SOAP响应中获取标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在C#中使用基于SOAP的服务时,我的价格低于三行。
i想要删除或忽略相同。请提出是否有任何解决方案。
Hi,
I am getting below three line while consuming SOAP based service in C# .
i want to remove or ignore the same. Kindly suggest if there is any solution.
Content-Type: text/xml; charset=utf-8
Content-Transfer-Encoding: binary
Content-ID: <0.8788fd1f238c5bd025268ecbf502e58726ca092a8ce8fe81@apache.org>
我尝试过:
What I have tried:
using (WebResponse response = request.GetResponse())
{
response.Headers.Remove("Content-Type");
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string soapResult = rd.ReadToEnd();
string str = HttpUtility.HtmlDecode(soapResult);
}
}
推荐答案
这样的事情:
using System;
public class Program
{
public static void Main()
{
string str = @"Content-Type: text/xml; charset=utf-8
Content-Transfer-Encoding: binary
Content-ID: <0.8788fd1f238c5bd025268ecbf502e58726ca092a8ce8fe81@apache.org>
Here starts the real stuff, blah, blah, blaaaaaaaaaaah.";
int pos = str.IndexOf("@apache.org>") + "@apache.org>".Length;
str = str.Substring(pos);
Console.WriteLine(str);
}
}
这篇关于使用httpwebresponse在SOAP响应中获取标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文