• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Error creating instance for Web Service referece in ASP.Net 3.5 C#

Hi,
----Trying to learn Web Services----

Unable to create instance of the WebService reference in ASP.Net 3.5 using  VS2010.

- Added web reference successfully to my Project -> References-> WebReference ->  example:- "http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx?wsdl".
                   "com.cdyne.ws" is the name of my reference.
- in my project file default.cs
  com.cdyne.ws myws = new com.cdyne.ws();     -> error
   " ...is a namespace but used like type"

pls let me know if i'm missing any thing.

Thanks



 
0
kishan66
Asked:
kishan66
2 Solutions
 
strickddCommented:
com.cdyne.ws is the webservice namespace. you have to create an instance of the correct object in the namespace. Most likely:

com.cdyne.ws.delayedstockquote myws = new com.cdyne.ws.delayedstockquote();
0
 
ToddBeaulieuCommented:
Hi,

The web service that you added and named is NOT a type. It's a container.

If you type that name and hit "." to get the context drop-down you'll see that it contains types within it. In your example, you want to use "com.cdyne.ws.QuoteData" as the type to instantiate.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now