.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Class project in Web Service-consuming website

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :.NET Framework
I have a website project in VC2008. I add a web reference to a web service, and give it a name (ws). I can now do this:         ws.Service testService = new ws.Service();         ws.Customer objCustomer = testService.GetCustomer("1");   Perfect. Now, is it possible to move the Web Reference into a class file, referenced by my web project? I've done that, but now I can't access the ws object from the website application. Is this even possible? I've seen it done in another project, which I've tried to mimic exactly, but it's not working for me. Could it be an older version worked like that??   Thanks Sean

View Complete Post

More Related Resource Links

VS2010 Professional .NET 4.0 Remote Debugging ASP Website Project


Trying to remote debug ASP website from VS2010 Pro to Windows Server 2003 machine.  Specifically, trying to debug a Web Service, but breakpoint says, "The breakpoint will not currently be hit. No symbols have been loaded for this document."  This happens for all compiled code though.  I have read this is due to missing PDB files and the work around is to manually copy them, as noted here.  Problem is, I cannot find any PDB files for my project, except referenced libraries, which I can remote debug.


  • web.config has <compilation debug="true">
  • Debugger is attached to wewp.exe process on remote server
  • Installed VS2010 remote debugger from DVD (as I can remote debug referenced libraries)

This is beyond frustrating.  I migrated my code from VS2008 .Net3.5 to VS2010 .Net4.0 to take advantage of the inherent multithreading framework.  Debugging works when using local host and was stable until deployment to test server.

Thanks in advance,


problem in consuming WCF service through Window application


I have a silverlight application and WCF service all made in VS 2010 , i had hosted my site to web server which contain Window 2008 and IIS 7.0

now the problem is i have another application which is a window application developed in VS2008 , when i try to add the service reference it gives me error


The document at the url was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'DISCO Document' is 'There was an error downloading 'http://dev_qa.emspa.com/HRDev3/Service.svc?disco'.'.

  - The request failed with HTTP status 400: Bad Request.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from '' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: ''.

Content Type application/soap+xml; charset

Service Station: Creating And Consuming Web Feeds


Jon Flanders demonstrates creating and consuming Web feeds with Windows Communication Foundation and AtomPub.

Jon Flanders

MSDN Magazine April 2009

Consuming a PHP service.


I'm working with an outside company to impletement their API into our program. Most of their member functions working pretty solid. I get to the one function where I have to pass an associated array to it and this is where it blows up. I create a hash table or namevaluecollection and of course I will get the error(The type System.Collections.Hashtable is not supported because it implements IDictionary.), which can't be serialized.

Is there an easy way to pass this associated array to them? I don't think their api is very flexible, but they seem to think so.

Web Service and Base Class Sub Routines



I have several Web Services that I call using jQuery, they are all <WebMethod()> _    Public Function and return either a boolean or string, depending on the function.

I have some Web Service functions, where I would like to call sub routines I have in my base class, they are Public Sub's.

When I add a call of a sub routine in the Web Service function, I get a blue line that says 'Object reference not set to an instance of an object'.  If I change the sub routine to Public Shared Sub, then the blue line and error go away, but I get other errors from the calls I was successfully making to the base class routines before.

Is there a way to get these two to work together?

Error Consuming Web Service - Unable to import binding xxx from namespace ...


In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MathService
        public float Add(float a, float b)
            return a + b;


I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

How to update row using Domain Service Class programmatically?

How to update row using Domain Service Class programmatically in Silverlight without bind to any datagrid and other control? Please help.chanmm

How to update row using Domain Service Class programmatically?

How to update row using Domain Service Class programmatically in silverlight without binding to any datagrid and so? Please help.  chanmm

All data in class properties disappear across WCF service

Hi, I have a class that i share betwee silverlight client and wcf service. I populate properties of the class with real data from the client, to be used in the server. I use debugger to step through the code when the call gets to the server, all the data ara gone and are replaced with null. All DateTime value change to 1/1/1001. But if pass primitive types such as int, string, no problem. This is happening only on one machine, but not on ther machine. Can someone tell me what is going on here? Thanks in advance

Trying to call an asmx web service from a test project

I am trying to create a proxy for an asmx web service. The only thing I find in Visual Studio 2008 is a service reference. How do I call an asmx web service with a service reference? Certified Geek. Professional Data dude.

Consuming a WCF Service using SSL

I have a WCF Web Service that has been created with VS2010 using Framework 4.0.  The service accepts an XML file along with a user and password. The service performs exactly as it should until I turn on "Require secure channel" on the virtual directory.  I was receiving errors relating to the endpoints, however, now I have fixed those issues and receive a different error. I have created a separate web site project to consume the web service, again using VS2010.  When I select the button to invoke the call, I receive "The request failed with HTTP status 404: Not Found". The stack trace is as follows: [WebException: The request failed with HTTP status 404: Not Found.] testservice._default.ws_LoadAOCDataCompleted(Object sender, LoadAOCDataCompletedEventArgs e) in c:\my documents\visual studio 2010\Projects\AOCSvc\testservice\default.aspx.vb:38 testservice.aocsvc.AOCService.OnLoadAOCDataOperationCompleted(Object arg) in c:\my documents\visual studio 2010\Projects\AOCSvc\testservice\Web References\aocsvc\Reference.vb:104 System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback callback, Object state) +73 I am new to web services as well as WCF and Framework 4.0.  Again, the service works correctly until I turn on SSL. Any ideas on what may be "locking" the service?  I have rea

Error in consuming web service using WCF client

Hi, I have consumed an external webservice in my client application using WCF. And every thing works great in my Dev box(XP with IIS5.1) But when the same application is moved to Prod server(Win Server 2003 with IIS6.0) it fails. Below is the exception caught: There was no endpoint listening at http://MyExternalWebServiceUrlWithSessionId could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. And the InnerException is: Unable to connect to the remote server My Config file has the below settings:<system.serviceModel> <bindings> <basicHttpBinding> <binding name="Default_Binding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCoun

calling a web service on a remote server from a ASPX page (web site project VS2005)

HI,I am maintaining a web site project in VS2005 and have to call a new web service on a remote server. I've done add web reference, and created the .wsdl and .discomap files in the app_webReference folder.  When I try to create a object representing the web service in the code ( wsnamespace.serviceName ws = new wsnamespce.serviceName(); ) the code wouldn't compile.The web site project is already calling other web services. When I right click on the type representing the web service and "go to definition" it takes me to a proxy class (derived from of course SoapHttpClientProtocol) in the metadata. I think this is what's missing for  the new web service i'm trying to call. Have I missed any steps?Thanks in advance.-me

consuming a web service in silverlight

Hi all,      I am new to silverlight. I have to develop an application where I have to consume a web service http://www.xignite.com/xRealTime.asmx?WSDL to display the real time stock price on a data grid in the silverlight application. Can anyone please tell me if it is possible and if the answer is yes how do I go about it.If the answer is no please tell me what is the best way to display these values using a silverlight application.     

Workflow Service not calling workflow in another project

I have a windows workflow service 4.0 that calls a workflow located in another project (i.e. another assembly). I have created a project reference in my workflow service project to the workflow in the other assembly. I have set a breakpoint in the workflow service receive activity and this breakpoint is hit. Next I step into the next activity which is an activity located in another project and the debugger does not work. Also the other workflow is sending an email.  It appears that the other workflow is not being called because I never receive an email from the workflow in the other project.   Any help is greatly appreciated.

Visual Studio Hangs when Creating a New Website or Project

Greetings, Just as the subject says, my VS'05 installation hangs when trying to create a new website.  I even installed a fresh version of VS08 along side '05 and '08 is doing the same.  Any ideas on a fix or where to look? Thank you in advance. 

Consuming Web Service. Dynamic WSDL ???

Hi everyone. I'm trying to consume a web service with my asp.net application. I've done the basic procedure of creating proxy classes but it won't work. After I spent hours debugging and talking to network support, I realized that a section within the WSDL was dynamic. The WSDL is located in a url like this: http://service/MyWebService?WSDL In the WSDL I have a section like this:<s0:service name="MyWebService"> <s0:port binding="s3:MyWebServiceSoap" name="MyWebServiceSoap"> <s4:address location="http://server1/MyWebService" /> </s0:port> </s0:service> If I press F5 on the browser, the WSDL shows a different address (only the server changes, actually). The range goes from server1 to server9. I've been informed that this service was hosted with some sort of balance system that redirect the requests amongst different servers according to a number of rules. I was also told that I only needed permission to access the balance server ("service"). So, I actually can't see those other "real" servers. When I generated my proxy classes, WSDL showed a path for server1. When I run my application I get a connection error ponting to the IP of server1. They said they can't give me permission to connect directly to server1 because it would kill the balance system. So, how can I con
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend