Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • 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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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