Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Consume C# WS in C# App
Message
 
To
17/03/2008 01:06:02
General information
Forum:
ASP.NET
Category:
Web Services
Miscellaneous
Thread ID:
01302443
Message ID:
01302651
Views:
6
OK, I downloaded your file and you've got a few things wrong here.
This should not surprise you at all. :)

I see the issue. I'll come up with a more appropriate namespace.


Yesterday I was working at home when i posted. Now I'm at the office, and I have rebuilt and readded the WS to
my project. I still only see one file.

http://www.geocities.com/zephaneas/project1/project1.jpg

One thing I wanted to check: I went to Tools/Options/Document Tab and turned on 'Show Misc Files'. Is this the
option you're referring to?


Lastly, and I don't know if this is related, I have a GetUser() method on the WS. I'm throwing a comp time error:
http://www.geocities.com/zephaneas/project1/project2.jpg

The method appears on the WS:
http://www.geocities.com/zephaneas/project1/project3.jpg

I'm not sure is this is NS related or just more newby mistakes.

BTW, thanks for the help.




>OK, I downloaded your file and you've got a few things wrong here.
>
>First off, your namespace. If you look at the properties for the project CSDataAccess (right-click on the project in Source Control and choose Properties) and look at the first page of the properties, the Application tab ... you'll see a spot to put the Assembly name and Default namespace. It always defaults to the name of the project, so yours is CSDataAccess. But, when you created the CSDataAccess file in the project, you changed the namespace to Marois. That'll come back to bite you, as you'll see in a minute.
>
>Secondly, I don't know what you're not seeing, but when I specify "Show All Files", there is sure enough 4 files under "MyWebService" ... reference.map and .cs and services.disco and .wsdl. (remove that extra reference.cs that you added ... it does not belong there!)
>
>If you'll look at the reference.cs file, you'll see how changing the namespace in the wrong place comes back to bite you ... the namespace of the generated reference.cs file is the namespace specified in the project's properties, so it's namespace is CSDataAccess.MyWebService. This is the way namespaces work. Everything in this project should use the same namespace. It's just a bit more organized that way. If you wanted it to be Marois, then you need to change it in the project's properties (personally, I think it should be more along the lines of Marois.DataAccess though, but for this example, I just went with what you had ... Marois).
>
>Once you do that, then you'll see that the following will work ... you'll get Intellisense and everything:
>
>
>Marois.MyWebService.Service oWS = new Marois.MyWebService.Service();
>
>
>Actually, what was probably causing the problem was the fact that your class and your namespace were both called CSDataAccess and since that was also the namespace in the reference.cs file, VS was getting mighty confused.
>
>[UPDATE] So, if you didn't change the namespace (and left it all as is) then put a using CSDataAccess.WebService, then you could instantiate it like this:
>
>Service oWS = new Service();
>
>You simply can't use
>
>CSDataAccess.WebService.Service oWS = new CSDataAccess.WebService.Service();
>
>while you are in a class named CSDataAccess. Unless you have a more differentiating namespace. Typical standard for namespaces is:
>
>MyCompany.MyProduct.MyModule
>
>You can also go one step further (we do), and do this:
>
>MyCompany.MyProduct.MyLayer.MyModule
>
>where MyLayer is stuff like WinUI, Business, WebService, DataAccess, etc.
>
>~~Bonnie
>
>
>
>>Bonnie,
>>
>>I removed the WS, deleted it, recreated it, and readded it ot the project - same situation. The
>>References.cs file did not appear in the project. I added it manaully.
>>
>>This seems like it should be a no brainer. ALl I've done to this point is create one class with 4 small
>>methods, one of which calls the WS. I'm not sure why this is so difficult.
>>
>>Don't know if you have a moment to look at it, but I would appreciate it if you can.
>>http://www.geocities.com/zephaneas/project1/csdataaccess.zip
>>
>>I wouldn't normally ask someone to poke into something so simple, but I'm stuck at this point.
>>
>>Kevin
>>
>>
>>
>>
>>
>>
>>>Kevin,
>>>
>>>My point is that that should have already been part of your solution and should have been in your MyWS folder. There are 3 other files that go with it as well. Were they in that MyWS folder also? You should not have to add them to your solution, they should be included when you add the web reference. Where did you put them? Perhaps you should simply remove the web reference and add it back in again. Maybe it will regenerate it correctly this time.
>>>
>>>You should be able to do something like this:
>>>
>>>CSDataAccess.MyWS.Service oWS = new CSDataAccess.MyWS.Service();
>>>
>>>If this is not showing up correctly in Intellisense, then you may have added the Web Reference incorrectly.
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>
>>>>>>What am I doing wrong here????
>>>>>
>>>>>I don't know ... you should see 4 files. Try looking in the folder itself with Windows Explorer and see what you see.
>>>>>
>>>>
>>>>
>>>>Ok, I did a Win search for the References.cs and added it to the solutuon. It has:
>>>>
>>>>
>>>>
>>>>namespace CSDataAccess.MyWS {
>>>>    using System.Diagnostics;
>>>>    using System.Web.Services;
>>>>    using System.ComponentModel;
>>>>    using System.Web.Services.Protocols;
>>>>    using System;
>>>>    using System.Xml.Serialization;
>>>>
>>>>
>>>>    /// <remarks/>
>>>>    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433")]
>>>>    [System.Diagnostics.DebuggerStepThroughAttribute()]
>>>>    [System.ComponentModel.DesignerCategoryAttribute("code")]
>>>>    [System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://tempuri.org/")]
>>>>
>>>>    public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol {
>>>>
>>>>    .
>>>>    .
>>>>    .
>>>>
>>>>
>>>>
>>>>I'm ont entirely sure what to do with this.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform