WCF / ASMX :: Returning List From Wcf Service?
Sep 19, 2010
How is it possible to return some kind of list from a wcf serivce, this the method in my wcf service
my interface:
[Code]....
and this how my GetRootLocations looks like, It returns IQueryable, I wounder if I can maybee return Iqueryable from my svc-service?
[Code]....
View 5 Replies
Similar Messages:
Mar 25, 2010
I'm using a web service and I want to return a list to my client. I am nearly newby at web services and I can't return a List<String> object to my client. But when i call the method it says "Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.String[]'" What should I do?
View 2 Replies
Sep 14, 2010
I am developing an application with WCF services. The basic functionaloty of a screen is to provide an entry screen to add particular entity. Once save even fired It will save the data to the database and call the bind method to bind into the grid by refreshing the latest data.
When I am running the site from my source (Visual Studio) , it works perfectly. When the client calls method to fetch the data the WCF service, it returns latest (added) data. But the issue comes in the server when it works with IIS. I deployed the code in the server, once the data added I am getting the old data only. But after two refresh I am getting the latest data.
what required to be done to get the latest record.
View 3 Replies
Oct 11, 2010
I am trying to deploy a wcf service. I have created a simple service, basically I have created a new wcf service and tried to deploy it however I get this error
The type 'WCF_Application.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
I am trying to deploy my service to a subdomain like
https://services.mydomain.com/business
My config looks like this
[Code]....
View 3 Replies
Mar 2, 2011
Ok so I am trying to setup a WCF web service. I thought I had my .svc and webConfig ready to go, but when I hit this service all I get is a blank page.
[Code]....
View 1 Replies
May 3, 2010
I have to return collection of parent and child objects in a web service but I am not being able to solve this.
look below code blocks where i will try to explain my problem:
This is my web method which returns a list of parents
[Code]....
[Code]....
Below is my child Class:
[Code]....
View 1 Replies
Jan 20, 2011
I've been reading quite a few tutorials on web services and xml files and one thing isn't quite clear to me. If I want to create an XML file on the fly the tutorials are pretty straight forward but, I want to grab an existing XML file from the web server and return the whole thing. Do I need to read the XML file and send each individual node or is there a way to send the file all at once? The tutorials imply that the whole file could be a node but I'm not clear on what that entails or if it would work. Also do you have a link to an example?
View 1 Replies
Oct 19, 2010
Would it be better in terms of payload, if I return a datatable as a List<DataRow> from a WCF method? I have WsHtppBinding for my WCF. I am expecting the datatable to contain 5,000 to 10,000 records.
Also, how can I test the difference in payload sizes when returning a DataTable Vs List<DataRow>?
View 2 Replies
Aug 25, 2010
I Need by service contract to return the xml/json result depending on the request type. function which will convert my result set (i am using linq to sql) so that i do not need to create the xml format for the result set by iterating through the table row many times.What is the suitable way to do that.
I need a kind of short cut method which will convert the table data to xml result.Had i been using asp.net mvc i would have been able to generate the xml data by overriding the the ExecuteResult method in the ActionResult and giving Conetnt-Type = "text/xml" as OP.But since i am using Wcf i don't have the controller context(as controller context is the parameter that needs to be passed to Execute Result).
My present code for converting the table data to the xml format is below.
public XDocument UsersLists(string authToken)
{
bool IsAuthenticated = Authenticate(authToken);
XDocument xDoc = new XDocument();
XElement root = new XElement("Users");
[Code]....
I need to eliminate this way of generating xml for each table records.
View 1 Replies
Mar 25, 2010
I need to pass a random number from 1 to 100 from the client to a webservice, and then the webservice will subtract this number from the list of 100 numbers (say 1-100). Then, in the next call, the next random number will be subtracted from the rest 99 numbers and so on.
I need this to be done with AJAX. I don't know where the Array list should be held in the first place (would it be in the web service or in the code behind? ), and how this can be done?
View 2 Replies
Jul 18, 2010
We have a web project that contain its business methods in a class library project called "Bll.dll"
some methods of Bll.dll return List<> ... from a source - that i don't remember now - told that returning Collection<> is better than returning List<> Is it a valid ? Note that i don't make any process on values returned from BLL methods .. just view it in a web page
View 5 Replies
Sep 17, 2010
Ive created a webservice that returns an xmldocument
[WebMethod]
public XmlDocument Invoke()
{
//code here
}
when I add a webreference to a consuming project, the return type is classed as XMLNode, anyone know why?
View 1 Replies
Dec 7, 2010
I have read a lot of posts describing why it isn't good practice to return heavy objects like DataTable/DataSet to the client from WCF. However, there doesn't seem to be much discussion about the alternatives (or maybe I'm not looking in the right forums).
My problem is this: I've tried to convert my DataReader/DataTable into a List<List<string>>, where List<string> represents the data in each row, but get an error at the point when the data is being sent to the client. A simple List<T> or a one-dimensional array gets returned without any problems. But whenever I try to return a collection of collections, there seems to be an issue. I don't know until runtime what my DataReader would look like as different stored procs are called based on user selection from a web form.
What am I missing here. Is WCF not able to handle collection of collections (I know that multi-dimensional arrays are not supported)?
View 1 Replies
Jul 8, 2010
I am using C# 2.0. I am trying to create a webservice that returns a pdf file.
I tried this:
[Code]....
Is this the correct way? I am not getting any errors, but want to know, if this is correct.
View 6 Replies
May 5, 2010
if i have the web application with many pages like add order page, edit order page, and delete order page actually they also interact with the Sql Server 2008 and i also create web service page call Sales_Service.asmx. i know just i need to put something like query into Web Method in Sales_Service.asmx but i have a lot of queries, i don't know which query i should put into it and how the web page call the Sales_Services.asmx
View 2 Replies
Nov 8, 2010
A customer reported that our asmx web service is continually increasing in memory (mem usage as well as private bytes). We are able to reproduce the problem in our lab with Windows 2003 Server SP2 (fully patched) on some of the machines. The customer is using Windows 2008.
We created a Hello World web service targeting the 2.0 framework built under VS2005 SP1 and a test client that continues to call it. The memory increases steadily - approximately 40K per client request. If the test app is paused, the memory remains the same. When it is closed, the memory drops. Explicit calling of GC.Collect does not drop the memory.
We have run the memory profiler on the service and the leak is all native memory. We have uninstalled/re-installed the Framework on one of the machines but no difference. To our knowledge all of the security and IIS settings are not modified. We have compared app pool, default web site and virtual directory properties to machines that have no problem and they are identical.
View 11 Replies
Mar 17, 2011
I have a .net app developed in .net 4.0 version. And I implemented an asmx web service in this. Now I want to call one of the webservice method in another classis ASP application java script function.
View 2 Replies
Mar 10, 2010
I have a problem with getting jquery to retrieve results from a WCF service. I am hosting the WCF service within IIS and when I attach the debugger to this process I can see that the code is processed successfully. However, when it hits the callback within jquery there is no data??
I have set up a trace on the wcf service and there are no errors. It just seems as though the data is lost after the wcf service method completes.
Here is the jquery code which calls the service:
$.get("http://ecopssvc:6970/ecopsService.svc/Echo", {echoThis: "please work"}, function(data) {
alert("Data Loaded: " + data);
});
Here is the wcf config:
<system.serviceModel>
<services>
<service name="EcopsWebServices.EcopsService" behaviorConfiguration="EcopsServiceBehaviours">
<endpoint address="" behaviorConfiguration="WebBehaviour"
binding="webHttpBinding" bindingConfiguration="" contract="EcopsWebServices.IEcopsServiceContract" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehaviour">
<webHttp />
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="EcopsServiceBehaviours">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Here is the service contract:
[ServiceContract]
public interface IEcopsServiceContract
{
[WebGet]
[OperationContract]
string Echo(string echoThis);
}
Here is the Service implementation:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class EcopsService : IEcopsServiceContract
{
#region IEcopsServiceContract Members
public string Echo(string echoThis)
{
return string.Format("You sent this '{0}'.", echoThis);
}
#endregion
}
View 3 Replies
Mar 28, 2011
Is it possible to run a web service as a particular user/service account in the same way a Windows service can?I have a service account used for connecting to the DB and want to run the webservice under this account as the users using the webservice won't have DB access.The way I see to do it is to include the Impersonate option in the Web.config file, but is there any better way to do this?
View 1 Replies
Mar 17, 2011
How to create an instance of web service without adding web service reference? How to identify the server address/name where the web service is hosted from C# code?
View 1 Replies
May 25, 2010
My WCF Client calls my WCF Service which then calls ASMX Web Service. The problem is i have configured my wcf client and wcf service to windows credentials type but when wcf service calls asmx service the user credentials (default windowsidentity) is not passed to asmx service.
In WCF Service i am able to get user identity by using : Thread.CurrentPrincipal.Identity.Name;
WCF Service - i have disabled anonymous access and enabled windows authentication. ASMX Web Service - i have disabled anonymous access and enabled windows authentication.
WCF Service Config
[Code]....
View 1 Replies
Aug 4, 2010
i have created a normal web service and i want to host it outside IIS. one idea i got is to use window service as hosting environment. i have created a web service and hosted it window service and its window service is running now.would anybody please let me know that how can i call web service hosted in window service binded over soap.tcp. here is my sample code.
[Code]....
[Code]....
View 1 Replies
May 26, 2010
I want to develop a web service that handle another web service's event. (C#.Net 3.5 framework)
View 1 Replies
Mar 23, 2010
I have some WCF services that I want to return in different formats based on a querystring param. For example, [URL], [URL], [URL], etc... This would make it so that many different types of clients could consume the services whichever way was easiest for them, such as binary for a .NET client and json for an ajax or Flex client.
What I'm thinking is that I can have the WCF web methods return their .NET business objects and not worry about the output mode and then have a behavior that hooks in after returning from the web method which checks the querystring for this param and either:
1. Continues returning the business objects if the mode is dotnet.
2. Converts the business objects to xml if the mode is xml and returns a string of xml.
3. Converts the business objects to json if the mode is json and returns a string of json.
View 2 Replies
Jul 28, 2010
I'm trying to communicate with a Windows-hosted SOAP web service using PHP's SoapClient.The Web Service is intended to insert a new record for a member into a database.I can verify that my code using PHP's SOAPClient can successfully transfer the data via the Web Service to the database,but I am not getting the expected return value.
The Web Service description for what I should be getting as a return is described below.On successful execution of the Web Service code,I am getting nothing back despite calling LastResponse function and LastResponseHeaders.It seems no XML is getting returned at all.I am using other API calls within this Web Service and they all seem to work fine with the expected XML returned whenever I invoke a method.but for this one,which involves sending data,I'm not getting a return
View 1 Replies