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

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

How to overload webservice constructer?

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :.NET Framework
Hi, I have following class in webservices, I am not able to override the constructer of webservice. Asp.net always call first method not the one with parameter.  ------------------------------------------ Public Class Employee           Public Sub New()           End Sub          Public Sub New(ByVal Str as String)           End Sub      End Class   ----------------------------------------------------- I am creating object in following way: Dim obj as new Employee("Parameter") I get error" too many arguments" Is it true that webservice methods can't be overloaded? 

View Complete Post

More Related Resource Links

saving XML output from webservice


 I created a webservice that takes casenum as input and gives results as a dataset in an XML.

I could make a web client to display the resulting dataset in a grid view. Pls see my code copied below.

Now I want to create a console client that takes the casenum as input, to call the webservice and saves the resulting xml for further processing, but can't figure out how to just capture the xml to save. Here's the code for my web client. I would appreciate if you could help modify this tocapture the resulting xml to save file locally.

Thank You.

namespace ResultsWebServicesClient
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

        private void BindDataToGrid(string CaseNum)
            FG_Results results = new FG_Results();
            DataSet ds1 = new DataSet();
            ds1 = results.Get_FG_Results(CaseNum);
            GridView1.AutoGenerateColumns = true;
            GridView1.DataSource = ds1.Tables[0];

        protected void GetResults(object sender, EventArgs e)


HTTP Post and WebService


I am working on a application which will accept the data in the post request. My application also wants to expose a web service and want to call another web service. Considering all these 3 action that I want to do, can I create a single application which will have a web form which will accept the POST request and expose a web service at the same time.

Although it may be possible to achieve this, Is this a correct way of doing it?

Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

C# / Java webservice


I am writting a client applicatin that acesses a webservice written by another company.  I need to test against this webservice but since it is live I need another place to test with.  I don't have access to the code from the webservice but have added a reference to my project.  I would like to create a test platform using C# which will run on IIS and not Java.

I have created a basic webserive using both the NetBeans platform and the VS/C# platform.  The problem I am having is if I dynamically change the web address from one to the other my client application complains that the webservice is invalid.  I have verified all the calls are the same.

Are there any setting with VS/C# that allow me to configure it to behave more like the Java webservice?  I don't have the server support to host the Java application for full testing along with other problems using the Java version.

I have run both services in the "WCF Test Client" and can see where the WCF service uses the varibles for request and the Java uses body/request but can't get the WCF to follow that format.  I read somewhere about changing the OperationContract with SoapRpcMethod but then the mentod is not longer exposed. I also tried a Web Service in .NET 3.5 instead of a WCF server but that seems to be more trouble and does not

Printing crystal report from webservice



I am trying to print crystal repot directly from a C# application, which is calling webservice. I am able to display report in crystalreportviewer by passing the webservice call to datasource. However, is there anyway, I can print directly without showing the report?

Alternatively, I was trying return ReportDocument object from webservice, which would solve my problem, but I was unable to return the ReportDocument because of serialization issue. Is it even possible? Thank you


Writing Data to database with jQuery Forms, ASMX Webservice, & JSON - help!



Can someone point me in the right direction on how to submit data from a jQuery form to a ASMX webservice? I have gotten everything on the form ready to be submitted to the database and now I am stuck on how to send it over using $.ajax(). Everything I have read tells me how to get data from a webservice and display it with jQuery, but not the other direction nor how to access the json data within the within the webservice service(similar to a Request.Form approach with ASP.NET forms).

In other words: 

1. What do I need to do to my webservice to make sure it can receive data from the jQuery form. 

2. What do I need to do in jQuery to receive an acknowledgement the save on the server side was successful. 

I can explain more if need be, but if there is a comprehensive tutorial on not only reading, but also WRITING data with jQuery, JSON, etc. I would love to get pointed in that direction. 

Webservice using socket layer programming



   I want to access a webservice in asp.net programming. This webservice was done using socket layer programming and also i am having the ipaddress and port address. Did any one know about how to access webservice using socket layer and if know let me know how to access the webservice. Thank you

problem with webservice



I wrote a program that connects to a webservice (with client side script such as jquery) and fetches data from  the webservice.

Now the program is working properly in local system, but when I upload it to host, the script cannot connect to the webservice.

What is the problem?

[newbie] How to return a data record from a webservice (wsdl)?



vs2010, .NET 4.0

I have a webmethod which I want to return a data record (for example: name, surename, address, age, zip etc)

I wonder how to accomplish this. I think the solution is about creating an object which contains all the records serialized. And then the webmethod returns this serialized object. I'm not 100% sure how to accomplish this, if some of you good provide me with some tips, tutorial or link to an article explaining it, that would be great

UpdateListItems Webservice is not working on Photo directory in blogsite



   I have created a site using the standard blogsite template. By default it contains a picture library named "Photos". I want to create a new folder in this library using the UpdateListItems Webservice. But I am getting an exception saying "The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file." But there is not file/folder with the name I am specifying. I am using the following query to create the folder



  <Batch PreCalc="TRUE" OnError="Continue" RootFolder="/forexp/Photos">

  <Method ID="1" Cmd="New">

  <Field Name="ID">New</Field> 

  <Field Name="FSObjType">1</Field> 

  <Field Name="FileRef">/blogsite/Photos/TestFolder</Field> 




Please note that I can create the folder using the web interface. I also created a new picture library in the same site and used the same above query to create the folder and I am able to create the folder.


Search Webservice Impersonation









We are looking for some help with Impersonated SharePoint Search.

We are trying to execute a search with a given user and having no luck.


We have tried the methods in this article and it’s not hiding results that the user does not have access to.

webservice test



 I made a webservice but some methods cannot be tested, I get following message:

The test form is only available for methods with primitive types as parameters. 

Can someone explain me why this happens?


Calling a webservice in MVC using jquery works on dev box not prod box


I have a webservice that is part of the MVC project.  I am using VS 2010 MVC 2.0 on Windows 7.  When I run the web application locally the webservice call works flawlessly, however on the prod box using  2008 upgraded with asp.net 4.0 it fails.

I get an error "The controller for path '/services/traxservices.aspx/upDateCustomer' was not found or does not implement IController. "

Is there some type of issue with the settings in the global.ascx or in IIS that I am missing?


Any help would be appreciated.

GridView Paging + Unsupported overload used for query operator 'Distinct'


The issue is two fold in my ASP.NET Web Application. I need to use a custom Distinct() via LINQ to SQL, and then assign thevar as a DataSource to a GridView. If I use the custom Distinct that implements IEqualityComparer, I get "Unsupported overload used for query operator 'Distinct'" exception. but if i somehow get past this, i get "The data source does not support server-side data paging" exception on GridView.DataBind(). here is the code:

distinct_employees =
    (from emp in wsq.LIT_Active_Employees
    where (String.IsNullOrEmpty(ssFirstName.Text) ? (emp.FIRST_NAME == null || emp.FIRST_NAME.StartsWith(String.Empty)) : emp.FIRST_NAME.Contains(ssFirstName.Text)) &&
            (String.IsNullOrEmpty(ssLastName.Text) ? (emp.LAST_NAME == null || emp.LAST_NAME.StartsWith(String.Empty)) : emp.LAST_NAME.Contains(ssLastName.Text)) &&a

Access resource file using webservice


Hi I need to access a resource file in a web application, using a WCF web service.

The webservice will be hosted in the same domain as the web application, but its business logic is in another assembly.

How can I retrieve the correct resouce file (according to the current culture) from the business layer, and returning a List of KeyValue pair from it?

Thank you.

How to set WebService NameSpace in web.config file?


I am trying to put the namespace value as a key in web.config file, so that when I deploy this on production, I just have to change the namespace key in the config file only, not on all of my webservice cs files. But When I try to browse this webservice after changing this code I get compilation error.


    <add key="NameSpace" value="http://csi-dev-deep/"/>

MyWebService.cs (this code works)

[WebService(Namespace = "http://csi-dev-deep/")]

MyWebService.cs code changed to the following gives compilation error.
[WebService(Namespace = ConfigurationManager.AppSettings["NameSpace"].ToString())]

Compiler Error Message: CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

Your help is highly appreciated.

Thank you.

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