<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XML Web Services</title><link>http://forums.asp.net/28.aspx</link><description>All about building XML Web Services with ASP.NET - SOAP, WSDL, WCF, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=66&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3279647.aspx</link><pubDate>Tue, 07 Jul 2009 17:49:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3279647</guid><dc:creator>johnwsaunders3</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3279647.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3279647</wfw:commentRss><description>&lt;p&gt;This means that you&amp;#39;re going to have to change the client. The client is not set up to permit automatic redirection. See the &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.allowautoredirect.aspx"&gt;AllowAutoRedirect property&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Re: Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3277938.aspx</link><pubDate>Tue, 07 Jul 2009 04:00:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3277938</guid><dc:creator>Ramaraj.R</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3277938.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3277938</wfw:commentRss><description>&lt;p&gt;I agree with you John.&lt;/p&gt;
&lt;p&gt;We use siteminder authentication, if&amp;nbsp;we&amp;nbsp;pass the&amp;nbsp;Security tocken in the SOAP header then the siteminder will authentiucate the request. &lt;/p&gt;
&lt;p&gt;Now if we&amp;nbsp;set the permanent redirection in IIS then&amp;nbsp;when I try&amp;nbsp;to consume my web service it&amp;nbsp;throws Document Moved exception,&amp;nbsp;One of the web service will be set&amp;nbsp;as&amp;nbsp;&amp;nbsp;Ananymous access and from ther we are redirecting to a web service which is set for Siteminder authentication. Now the question is In this senario if I redirect, will siteminder authenticate the request?.&lt;/p&gt;
&lt;p&gt;When I tried with the permanent redirection it throws the following error&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The request failed with the error message:&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Document Moved&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Object Moved&amp;lt;/h1&amp;gt;This document may be found &amp;lt;a HREF=&amp;quot;&lt;a href="http://localhost/.../test.asmx"&gt;here&lt;/a&gt;http://localhost/.../test.asmx&amp;quot;&amp;gt;here&amp;lt;/a&amp;gt;&amp;lt;/body&lt;/a&gt;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;--Ram&lt;/p&gt;</description></item><item><title>Re: Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3276158.aspx</link><pubDate>Mon, 06 Jul 2009 07:01:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3276158</guid><dc:creator>johnwsaunders3</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3276158.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3276158</wfw:commentRss><description>&lt;p&gt;First of all, for the future, can you tell me why you thought adding a SOAP header would have anything at all to do with redirection? A SOAP Header is data in the message. Some piece of code has to &lt;i&gt;read&lt;/i&gt; it in order for it to be of use. &lt;/p&gt;&lt;p&gt;Also, have you tried the client with the permanent redirection? Does it not work? In what way does it not work?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3275867.aspx</link><pubDate>Mon, 06 Jul 2009 03:58:37 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275867</guid><dc:creator>Ramaraj.R</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275867.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3275867</wfw:commentRss><description>&lt;p&gt;Thanks for your reply &lt;strong&gt;john.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I need to know is there any way to redirect the web service request for the old URL to the New web service URL with the custom soap header.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We had a client appliation deployed in all the client machines &amp;amp; its a windows application. &lt;/p&gt;
&lt;p&gt;Now we have set the permanent redirection to that web service to another web service URL which is in another server.&lt;/p&gt;
&lt;p&gt;We can&amp;#39;t go back to the client and ask them to re deploy the client application. So need a way to do this without touching the client application.&lt;/p&gt;
&lt;p&gt;Please suggest a way for it.&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards,&lt;/p&gt;
&lt;p&gt;Ramaraj R&lt;/p&gt;</description></item><item><title>Re: Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3275683.aspx</link><pubDate>Sun, 05 Jul 2009 23:19:41 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3275683</guid><dc:creator>johnwsaunders3</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3275683.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3275683</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t know whether your code will help him, but it has a couple of serious flaws.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; First of all, you haven&amp;#39;t implemented any &lt;i&gt;using&lt;/i&gt; statements. Your code may leak resources when an exception is thrown. These should be used whenever you create an instance of a class that implements IDisposable.&lt;/p&gt;&lt;p&gt;Second, you should never construct XML by contatenating strings. XML does not follow the same rules as strings. In particular, what happens if your message contains special characters, like &amp;quot;&amp;lt;&amp;quot;?&lt;/p&gt;&lt;p&gt;Try the following. I haven&amp;#39;t had time to test it thoroughly, but it at least compiles&lt;/p&gt;&lt;p&gt;&lt;pre name="code" class="c-sharp"&gt;public XElement MakeSoapRequest(
    string webServiceUrl,
    string webServiceMethodName,
    XElement messageBody)
{
    var request = WebRequest.Create(webServiceUrl);
    request.Method = &amp;quot;POST&amp;quot;;
    request.ContentType = &amp;quot;text/xml&amp;quot;;
    request.Headers.Add(
        &amp;quot;SOAPAction: http://www.tempuri.org/&amp;quot; + webServiceMethodName);

    using (var stream = request.GetRequestStream())
    {
        XNamespace soapNamespace =
            &amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;;
        var envelope = new XElement(
            soapNamespace + &amp;quot;Envelope&amp;quot;,
            new XAttribute(
                XNamespace.Xmlns + &amp;quot;xsi&amp;quot;,
                &amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;),
            new XAttribute(
                XNamespace.Xmlns + &amp;quot;xsd&amp;quot;,
                &amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;),
            new XAttribute(
                XNamespace.Xmlns + &amp;quot;soap&amp;quot;, soapNamespace.NamespaceName),
            new XElement(soapNamespace + &amp;quot;Body&amp;quot;, messageBody));
        using (var writer = XmlWriter.Create(stream))
        {
            envelope.WriteTo(writer);
        }
    }

    using (var response = request.GetResponse())
    {
        using (var responseStream = response.GetResponseStream())
        {
            using (var xmlReader = XmlReader.Create(responseStream))
            {
                return XElement.Load(xmlReader);
            }
        }
    }
}
&lt;/pre&gt;&lt;br /&gt; :&lt;/p&gt;</description></item><item><title>Re: Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3274533.aspx</link><pubDate>Sat, 04 Jul 2009 10:07:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274533</guid><dc:creator>maverickhyd</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274533.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3274533</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;
&lt;p&gt;see&amp;nbsp;this code&lt;/p&gt;
&lt;p&gt;string webServiceUrl=&amp;quot;MyURL&amp;quot;;&lt;/p&gt;
&lt;p&gt;WebRequest Request = WebRequest.Create(webServiceUrl);&lt;/p&gt;
&lt;p&gt;HttpWebRequest HttpRequest = (HttpWebRequest)Request;&lt;/p&gt;
&lt;p&gt;HttpRequest.Method = &amp;quot;POST&amp;quot;;&lt;/p&gt;
&lt;p&gt;HttpRequest.ContentType = &amp;quot;text/xml&amp;quot;;&lt;/p&gt;
&lt;p&gt;HttpRequest.Headers.Add(&amp;quot;SOAPAction: http://www.tempuri.org/&amp;quot; + WebServiceMethodName);&lt;/p&gt;
&lt;p&gt;Stream Stream = HttpRequest.GetRequestStream();&lt;/p&gt;
&lt;p&gt;StreamWriter SWriter = new StreamWriter(Stream);&lt;/p&gt;
&lt;p&gt;string SoapRequest = @&amp;quot;&amp;lt;soap:Envelope xmlns:xsi=&amp;quot;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;quot; xmlns:xsd=&amp;quot;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&amp;quot; xmlns:soap=&amp;quot;&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&amp;quot;&amp;gt;&amp;lt;soap:Body&amp;gt;&amp;quot;;&lt;/p&gt;
&lt;p&gt;SoapRequest = SoapRequest + soapmessage;&lt;/p&gt;
&lt;p&gt;SoapRequest = SoapRequest + @&amp;quot;&amp;lt;/soap:Body&amp;gt;&amp;lt;/soap:Envelope&amp;gt;&amp;quot;;&lt;/p&gt;
&lt;p&gt;SWriter.Write(SoapRequest);&lt;/p&gt;
&lt;p&gt;SWriter.Close();&lt;/p&gt;
&lt;p&gt;WebResponse Response = null;&lt;/p&gt;
&lt;p&gt;StreamReader SReader = null;&lt;/p&gt;
&lt;p&gt;Response = HttpRequest.GetResponse();&lt;/p&gt;
&lt;p&gt;Stream ResponseStream = Response.GetResponseStream();&lt;/p&gt;
&lt;p&gt;SReader = new StreamReader(ResponseStream);&lt;/p&gt;
&lt;p&gt;string s = SReader.ReadToEnd();&lt;/p&gt;
&lt;p&gt;You can do by using webrequest and webresponse class&lt;/p&gt;
&lt;p&gt;u have to use system.Net namespace&lt;/p&gt;
&lt;p&gt;give your webservice url and&amp;nbsp;add custom soap headers using httpwebrequest.headers.add(..&lt;/p&gt;
&lt;p&gt;Thats it.&lt;/p&gt;</description></item><item><title>Web Service redirection with custom SOAP Header</title><link>http://forums.asp.net/thread/3273239.aspx</link><pubDate>Fri, 03 Jul 2009 10:04:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273239</guid><dc:creator>Ramaraj.R</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273239.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=28&amp;PostID=3273239</wfw:commentRss><description>&lt;p&gt;Currently we are using a client tool which will invoke a web service to do some activity. Since we have site minder authenticated web service we have added the custom soap header, so that by using the soap header site minder will authenticate the request. Till this while it was working fine. Now we need to move this web service to some other server / domain. We don’t have any control over the Client tool now. So is there any way to redirect the web service request for the old URL to the New web service URL with the custom soap header.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Header looks something like this&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;soapenv:Header&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;log:credentials&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;logonid&amp;gt;XXXX&amp;lt;/logonid&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;password&amp;gt;xxxx&amp;lt;/password&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/log:credentials&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;lt;/soapenv:Header&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Ram&lt;img title="Cry" alt="Cry" src="http://forums.asp.net/tiny_mce/jscripts/tiny_mce/plugins/emotions/img/smiley-cry.gif" border="0" /&gt;&lt;/p&gt;</description></item></channel></rss>