This is my first time creating a web service ... so I'm hoping this is an easy question ![]()
Basically, I have a normal windows class (call it myNamespace.myService). This class has a method that returns a serializable class object (call it myNamespace.myClass).
Now, I've written a seperate web service that's really just a thin wrapper around myNamespace.myService. (I call the web method, and behind the scenes it calls into myNamespace.myService, and returns an instance of myNamespace.myClass).
Now, all that works ... sort of - the problem is the return parameter. Instead of coming back as a 'myNamespace.myClass' object, it comes back as a 'myNewNamespace.localhost.myClass' object!
So how do I fix this Or what am I doing wrong
How do I get my web service to actually return a myNamespace.myClass object

Returning a custom class object
Latin4567
Thanks.
Daniel Roth
Xenolith
When compiling I get a bunch of warnings about the class being defined in multiple places, although it does compile. However, when I actually try to call it, I just get back an error: "There was an error generating the XML document".
pgloor
1) Select the project in the solution explorer and click the "Show All Files" button at the top of the solution explorer (or select Show All Files from the Project menu). You'll notice that all of your web services have + next to them in the solution explorer.
2) Expand the web reference branch and you will see a "Reference.map" file. Click on that file and open the properties window.
3) There is a property called "Custom Tool Namespace". Enter your desired namespace there (e.g. myNamespace), and all of the generated code will use that.
4) For good measure, I usually rebuild the project to make sure the new code gets generated and compiles without any name collisions.
hth
Todd Gray
harry8227
I've found a way around it ... not one I particularly like, but it works. I just wrote another wrapper class, this one around the web service. So it makes the web call, copies the members from the return class into a new myNamespace.myClass object, and returns that.
At least it means the calling projects don't need to worry about the web stuff at all - to them it's just a straight call to a windows class. That part I like ... but having two wrappers around my service, especially where one of them needs to know all the details of the underlying class object - that I don't like.
Anyway, it does work - so unless someone out there has another suggestion ...