Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2004

Tip: Looking for answers? Try searching our database.

Web Service exception

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Z - 23 Dec 2004 21:57 GMT
I have a web service, using wse2, sp2, that throws an exception:

Client found response content type of 'text/html; charset=utf-8', but
expected 'text/xml'.

The web service takes 2 string parameters and a byte array.  It returns a
string.

It works in a different environment and has worked just fine in this
environment until just the other day.  

When I got this error beofre during development, a simple rebuild of the web
service seemed to fix it (for unknown reasons!).

Is this a configuration issue on the web server, an issue with the
web.config file,  a property setting of the web service proxy object or the
soap context in the web service?

I have seen very little about this particular error and none of the
suggestions I've seen thus far have helped.
Ravi Singh (UCSD) - 24 Dec 2004 04:05 GMT
Hey Mike

I would suggest you first check the namespaces in the refrences.cs,
open the refrences.cs and readd the webservice. Additionally when you
add the webservice, ensure that you are at

http://localhost/SM/SM.asmx?wsdl and not
http://localhost/SM/SM.asmx
check this is so in the web.config file.

Hope this helps

-Ravi Singh
Mike Z - 27 Dec 2004 22:29 GMT
Thanks.

I re-added the web service. No help.

It may help to know that I am accessing the web service via a Windows
control hosted in IE.

In it, I dynamically set the web service url via a public property.  Could
this problem be related to a difference in the build between when I added the
web service with a local reference and the build on the web service in our
test environment?

It didn't seem to matter before this.  In fact, it was working just fine in
our test environment last week, but this morning crapped out with no known
changes.

It seems possible that there's an error being hidden by the html response,
but because the client expects xml, it hides it with another error.

Is there somewhere I need to explicitly set the response content type,
possibly as an attribute or a web.config entry?

> Hey Mike
>
[quoted text clipped - 9 lines]
>
> -Ravi Singh
Christoph Schittko [MVP] - 29 Dec 2004 03:52 GMT
Mike,

Your best bet is to get to the text of the error message. Since it's
html formatted it should be easy to read. If the returned error message
is the html error message from ASP.NET then it means something isn't set
up correctly at your web server.

Have you tried putting a tracing tool like tcpTrace [0] between your
user control and your web service? Since you mentioned that you are
reading the URL from a config file it should be easy for you to point
the client to the trace tool. The tool will then reveal the HTML
response of the server and get you on your way to troubleshoot the
problem. Note that you have to remove the trace tool once you fixed your
problems because WSE takes offense at the URL in the HTTP header not
matching the <To> SOAP header [1].  

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

[0] http://www.pocketsoap.com/tcptrace/
[1] http://weblogs.asp.net/cschittko/archive/2004/05/24/140906.aspx

> -----Original Message-----
> From: Mike Z [mailto:MikeZ@discussions.microsoft.com]
[quoted text clipped - 40 lines]
> >
> > -Ravi Singh
Mike Z - 29 Dec 2004 21:27 GMT
Thank you for the help.

This is what it turned out to be:

The html response occurred because my web service threw an unhandled
exception. Not good!  And because (I guess) it's hosted by IIS, IIS decided
to return the error as HTML, as is the usual.

I finally uncovered the original exception, re-coded to handle ALL exceptions
(I actually caused the exception in an exception handler!), and
now everything is good in web services land.

Thanks again for your help.

> Mike,
>
[quoted text clipped - 71 lines]
> > >
> > > -Ravi Singh

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.