asmx

How do I return pure XML from asmx web service?

只谈情不闲聊 提交于 2019-12-09 07:05:08
问题 I want an asmx webservice with a method GetPeople() that returns the following XML (NOT a SOAP response): <People> <Person> <FirstName>Sara</FirstName> <LastName>Smith</LastName> </Person> <Person> <FirstName>Bill</FirstName> <LastName>Wilson</LastName> </Person> </People> How can I do this? 回答1: Look at using the [ScriptMethod] attribute. 回答2: If you don't want the Response to be in a SOAP envelope, are you also not bothered about calling the web service using SOAP. e.g. you are not creating

Benefits to switching from classic asmx to wcf

不问归期 提交于 2019-12-09 06:17:36
问题 Recently I made the switch from using asmx web services to using wcf services, the transition is nearly finished, but I know I'm in for a lot of error checking and testing to make sure everything ported as expected. My question is - so far I can only think of 1 good benefit to using wcf, and that is you get an easy way to implement a singleton web service. Besides that I have to tell you, configuring a WCF Application seems way overly complicated, and I'll forever miss how easy it was to test

webservice - unknown web method parameter name methodname

こ雲淡風輕ζ 提交于 2019-12-09 03:36:31
问题 I called a webservice for fetching items in fullcalendar. The method is never called and firebug gives this error: * "POST [http]://localhost:50536/FullCalendar/ServicioFullCalendar.asmx/GetEventosCalendario POST [http]://localhost:50536/FullCalendar/ServicioFullCalendar.asmx/GetEventosCalendario 500 Internal Server Error 1.01s" "unknown web method parameter name methodname"* Here is the asmx.vb code: <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:=

WCF v.s. legacy ASP.Net Web Services [duplicate]

不问归期 提交于 2019-12-09 00:34:28
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Web Services — WCF vs. Standard Could anyone recommend me some documents to describe why WCF is better than legacy ASP.NET web services? I am especially interested in performance and security. 回答1: WCF is much more flexible: can be used over HTTP (like legacy ASMX) but also: can be used over NetTCP, MSMQ, wsHttp and so on WCF services can be hosted in IIS (like legacy ASMX) but WCF services can also be self

ASMX webservice - return JSON instead of XML

邮差的信 提交于 2019-12-08 19:53:44
问题 I have a web service that contains one method: [WebMethod] public string Movies() { using (var dataContext = new MovieCollectionDataContext()) { var query = dataContext.Movies.Select(m =>new{m.Title,m.ReleaseDate}).Take(20); var serializer = new JavaScriptSerializer(); return serializer.Serialize(query); } } The method properly serializes the object, but when I view the response in FireBug, it looks like this: <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">[{"Title

How to access a web service with overloaded methods

吃可爱长大的小学妹 提交于 2019-12-08 14:50:13
问题 I'm trying to have overloaded methods in a web service but I am getting a System.InvalidOperationException when attempting "Add Web Reference" in Visual Studio 2005 (here's the relevant snippets of code): public class FileService : System.Web.Services.WebService { private static readonly MetaData[] EmptyMetaData = new MetaData[0]; public FileService() { // a few innocent lines of constructor code here... } [WebMethod(MessageName = "UploadFileBasic", Description = "Upload a file with no

Where do I set the CookieContainer on a Service Reference?

落爺英雄遲暮 提交于 2019-12-08 14:48:47
问题 When adding WebService Reference to an ASMX Service on a .NET 2.0 project for example, var objService = new NameSpace.groupservices(); there exists, objService.CookieContainer = new System.Net.CookieContainer(); When adding ServiceReference to an ASMX Service on a .NET 4.0 project for example, var objService = new NameSpace.groupservicesSoapClient(); there isn't any CookieContainer property for objService A similar question was asked here with no positive solution. Could someone please guide

How Can I access WCF services using a Web Reference?

孤街浪徒 提交于 2019-12-08 14:14:19
What WCF configuration settings makes WCF service, so that I can access as old ASMX web services? How can I authenticate using Authentication header what I used in Old ASMX web services? Just use basicHttpBinding Here is an example of the configuration: http://msdn.microsoft.com/en-us/library/ms731347.aspx Check this out : ASMX to WCF migration 来源: https://stackoverflow.com/questions/1661340/how-can-i-access-wcf-services-using-a-web-reference

What should be returned from web service instead of datatable?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 12:39:13
问题 I have created a web service in which i need to return multiple records from a function. For that I used datatable, but found that as it cannot be serialized. So we can't use it. So I used dataset instead of datatable. My service is going to be used in PHP. I am not sure that they (PHP developers) will be able to get data from my dataset (returned from my webservice's function) or not. Please suggest me what I should return. Dataset or is there any other better option available? Thanks. 回答1:

Accessing a asmx service from windows-forms gives max request length error

左心房为你撑大大i 提交于 2019-12-08 12:16:14
问题 I try to upload a file using asmx service from windows forms. I have specified max request length in web.config where asmx service is hosted. The service works well when i try to upload a file from a web form where asmx service is hosted. Now the issue is when i try to upload a file using windows forms it gives me max request length error. The code of app.config of windows application is as: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="MySiteServiceSoap" closeTimeout="00