Click here to Skip to main content
15,890,426 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);

                }
            }
Posted
Updated 15-Jun-17 23:56pm

1 solution

Something like this:
C#
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);
	}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900