Link to home
Start Free TrialLog in
Avatar of nargov
nargov

asked on

Web Service Reference does not enable API in code

Hi,

I'm working on a project for school, in which we got a web service called SQLMailWS, and are supposed to write a client which uses its methods. I've added a Web Reference to the service in the project, that worked fine, but now I can't seem to use any of the objects or methods in the service. It seems that the IDE doesn't recognize that the reference is there.

Any Ideas?
Avatar of AvonWyss
AvonWyss
Flag of Switzerland image

Did you pay attention to ass a uses clause with the proper namespace to your source code (probably "uses SQLMailWS;" - depending on the refrernce you added)? Alternatvely, you can also use fully qualified names ("SQLMailWS.ObjectName.Method()").
Oops. Slipped a key - wanted to write "add a uses clause". Sorry about that.
Avatar of nargov
nargov

ASKER

Couldn't even place the 'uses' clause, since the compiler doesn't seem to recognize the reference at all.
Well, you created a new project and added the web service as web reference, right? Now in the main class (in the Class1.cs file by default), add the "using SQLMailWS;" clause. I don't see why you wouldn't be able to add this clause?
Avatar of nargov

ASKER

That's my question exactly, why can't I? It doesn't seem to compile.
When you open the object browser window, you see a liste of the referenced modules. If your web app in there? If yes, when you click on the [+], what opens up?
Maybe the proxy class' namespace has changed. Have a look at the generated classes, review the solution explorer to see what files are available, search for the files for the web service proxy and open them (if needed click the Show All button in solution explorer to see all files). Then have a look what exactly namespace was specified for the proxy class
Once you have added the webreference you must have a "localhost"(by default) reference listed in the Web References section.

Now if you see that,

Use---> NameSpaceOfURProject.AppName.localhost.method();



 
Avatar of nargov

ASKER

for some reason, when I try to add the namespace:

uses myproject ...

I'm not getting any options after the project when typing the dot (.)
As if the project doesn't contain anything.
nargov, would you mind answering the questions I asked, expecially what the class explorer shows? How are we experts suppoed to help you if you don't provide us with needed information to answer your question?
Sorry, I meant object browser. But still, please answer this.
Avatar of nargov

ASKER

Sorry. :)
In the object browser I get the web reference, and in it there is:
Reference.map
SQLMailWS.disco
SQLMailWS.wsdl
ASKER CERTIFIED SOLUTION
Avatar of AvonWyss
AvonWyss
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial