.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

Repository for consuming webservice

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ADO.Net


Can anyone suggest a design / implementation of a repository class for consuming webservice? So far i've seen repository examples that take a DAO class. Is this a good pattern?

View Complete Post

More Related Resource Links

WCF client consuming oracle webservice is inconsistently works

Hi, In my WCF client application, I am consuming the Oracle  webservices. Strangely this wcf client functioning inconsistently. That means sometime, it does not find the service endpoint and some times it does. Where the code and environment are absolutely same in both the cases. But when I use web services, I see the code works consistently. There is no endpoint listening at the address http://<serviceurl> Does any one faced similar issue with WCF? Thanks!

Error while consuming Webservice



I'm consuming one webservice which hosted in IIS in my windows service. While consuming that web service proxy method I'm getting below error.

But its not happening regularly, randomly it s happening. Sometime its working very fine.

Error is :

The content type text/html of the response message does not match the content type of the binding (text/xml;charset=utf-8). If using a encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 163 bytes of the response were "<html><head><title>Error</title></head><body> Either a required imersonation level was not provided, or the provided impersonation level is invalid </body></html>

Thanks in advance,

Multithreaded application consuming webservice latency


I am working on troubleshooting an issue with a multithreaded application I have created.  In the application I consume a web service that while I am troubleshooting does nothing more than sleep for one second. What I have done is used the TaskFactory to handle the thread management.

var scheduler = new System.Threading.Tasks.Schedulers.QueuedTaskScheduler(NUMBEROFPROCESSES);
    var factory = new TaskFactory(cancelToken, TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning, scheduler);
    tasks = new Task[lst.Count()];

for (int i = 0; i < tasks.Length; ++i)

     tasks[i] = factory.StartNew((obj) =>
      Worker mod = (Worker)obj;

, new Worker(parameter1, i, parameter2, lst[i].Field1, parameter3, lst[i].Field2));


In the worker class I have a public void Execute() {

Service1SoapClient c = new Service1SoapClient();    


This does

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

build repository from SQL 2005? for a Linq, Jquery autocomplete



  I have the a question am going about his correctly I have a database for categories, it has many fields and about 4000 records,  but with a Jquery autocomplete needing speed and the fact that I only need to return a key and category name. I did the following:  (oh just to note, MVC2, Ajax project)


    public class categorySearch
        public Guid Category_GUID { get; set; }
        public string Category_Name { get; set; }


and now for the repository

    public class categoryRepository
        internal List<categorySearch> FindCategory(string searchText, int maxResults)
            List<categorySearch> category = new List<categorySearch>();
            dbWebEntities storedb = new dbWebEntities(); 

            var getcat = storedb.Categories.ToList();

            foreach (var item in getcat)
                category.Add(new categorySearch { Category_GUID = item.Cat_GUID, Category_Name = item.Category_Name});

            var result = from c in category
                         where c.Category_Name.Contains(searchText)
                         orderby c.Category_Name

Consuming an RSS Feed


I'm looking to make a user control to display the 3 most recent posts from a blog on my home page. I've googled around a bit and found a few ways to do this, but none I'm quite satisfied with.

I looked at the XMLDataSource control, but I'm concerned about exception handling. If the remote feed fails, I want to just hide the usercontrol and let the rest of the page display as normal. There seems to be no clean, declarative way to handle this. An OnError event would be nice, especially if it had an e.ExceptionHandled property on the EventArgs object like some of the other DataSource classes.

Scott Guthrie blogged about an RSS Toolkit for .net 2, but that was four years ago and hasn't been updated.

I'm leaning towards Linq to XML, which would probably work fine, but I can't help thinking that there must be a simpler approach to reed RSS feeds since it's such a common problem.



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

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

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


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

Inside MSDN: Consuming MSDN Web Services


Get the inside track on how the MSDN team uses Web Services to power MSDN2.

Craig Andera

MSDN Magazine October 2006

Metadata: Create a Database Schema Repository with Meta Data Services in SQL Server 2000


SQL Server 2000 Meta Data Services is a repository technology that stores and manages metadata for SQL Server. Instead of building database schemas over and over, Meta Data Services allows you to freeze an entire schema for use in other projects. You can also use these schemas for training, testing, or debugging. In this article, the authors will review the various components of Meta Data Services and show how it can be programmed using a Visual Basic client, XML, and XSLT. They will also show you how to manage and manipulate your metadata by generating a simple database schema using a SQL Server repository.

Alok Mehta and Ricardo Rodriguez

MSDN Magazine May 2003

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