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?
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...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With