Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASMX Web Service - "This web service is using http://tempuri.org/ as its default namespace." message - but it shouldn't be

I've created a web service using Visual Studio ( 2005 - I know I'm old school ) and it all compiles fine but when it opens I get warned thus:

This web service does not conform to WS-I Basic Profile v1.1.

And furthermore:

This web service is using http://tempuri.org/ as its default namespace.

Which would be fine except my service begins thus:

 [WebService(Namespace = "http://totally-not-default-uri.com/servicename")]

Searching the entire solution folder for "tempuri" returns nothing. I can't find it mentioned in any configuration page acessible from Visual Studio. And yet it's right there in the wsdl:definitions list for the xmlns:tns attribute on the web service descriptor page when I view it through the browser and as targetNamespace in the same tag. I'm viewing it using Visual Studio's "debug" mode with the built in server from that.

Seems like something has got cached somewhere but I can't work out what and where- I've tried stopping and restarting the server, cleaning and rebuilding the service and going through the associated text config files with a text editor but no dice. Any idea what is going on?

like image 658
glenatron Avatar asked May 24 '10 16:05

glenatron


2 Answers

Ahem.

After a while trying to figure this one out, I got right back to the start and began questioning my assumptions. Usually in this kind of situation if nobody seems to have an answer I am doing something really dense.

Sure enough, I have a couple of classes in my Web Service file ( because it's a stub for testing and will not be used in the long term ) and I had completely the wrong class named in my .asmx file as the supporting code for the web service.

Once I corrected that, everything worked fine.

I'm not proud, it's far from my proudest moment, but I'll leave this just in case anyone else runs into the same problem...

like image 157
glenatron Avatar answered Sep 21 '22 10:09

glenatron


  • 1 from me too. I had the same problem but slightly different solution: My problem was because, like you, I had multiple classes in the same .asmx.cs file. I had data classes at the top, and the web service class below them, and the [WebService(Namespace = "...")] attribute was at the top of the file, above the data classes.

I found 2 solutions: either move the data classes to their own code files (probably best), or if you insist upon keeping multiple classes in the same file, move the data classes BELOW the web service class, or move the [WebService(Namespace = "...")] attribute to JUST BEFORE the WebService class.

like image 41
101chris Avatar answered Sep 21 '22 10:09

101chris