Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WebService proxy
This is the c# code which i use to bypass proxy to access the webservice since my system is using proxy. iam using VS 2010 and using the webservice in my windows application.
 
WebRequest.DefaultWebProxy = new WebProxy("http://IN02S10004:80/", true);

But still i get the error as follows.
 
system.invalidoperationexception client found response content type of text/html but expected 'text/xml'
 
also tried with the following code in app.config also
 
 <system.net>
    <defaultProxy>
      <proxy usesystemdefault="false"
          proxyaddress="http://IN02S10004:80"
          bypassonlocal="true"/>
      <bypasslist>
        <add address="http://www.webservicex.net/periodictable.asmx"/>
      </bypasslist>
    </defaultProxy>
  </system.net>
Posted 4-Jul-12 20:04pm
Edited 4-Jul-12 20:11pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Perhaps you need to login to the proxy?
 
WebProxy provides a constructor that takes credentials for Proxies[^]
 
Best bet is have a look at the HTML you're getting back instead of XML - it probably has some info in it
  Permalink  
v2
Comments
shamypnr at 5-Jul-12 1:13am
   
there is no credentials and the webservice which i use is a free one.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello,
I strongly suspect there is an issue with web service. The issue may not be with consuming web service. Try to access web service from outside your application.
 
please refer the following URLs
 
http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/3bf287ec-051f-4d18-9cc7-c65065f50e2c/[^]
 
http://forums.asp.net/t/1411427.aspx/1[^]
 
client found response content type of text/html charset=utf-8 but expected text/xml[^]
 
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/1cfec310-215f-4d71-a386-401ebf2fc065/[^]
 
Regards
Sebastian
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 5 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100