asmx

How to change Location(Url) of a Web Service and Update Web Reference programmatically?

℡╲_俬逩灬. 提交于 2019-12-19 11:44:27
问题 I have web service: http://127.0.0.1/something/someWS.asmx I am adding this as a Web Reference to my app but wont always be Localhost... it might change to http://www.something.com/something/someWS.asmx. How do I change the URL programmatically of my Web Reference? is it as simple as: using (var service = new MyApi.MyApi()) { //txtUrl is the site service.Url = "http://" + txtUrl + "something/someWS.asmx"; } ALSO, once I change it, how do I update it programmatically? (equivalent to right

How to set minOccurs to 1

倾然丶 夕夏残阳落幕 提交于 2019-12-19 10:52:11
问题 I'm building an ASP.NET web service. I've got my code defined as below, but I can't figure out how to the the wsdl to specify the minOccurs of the FirstName and LastName properties. I want those as required, and can not be empty. Is it possible? [WebMethod()] public void TestMethod(TestClass Test) { ... } [Serializable] public class TestClass { public string FirstName { get; set; } public string LastName { get; set; } } 回答1: I have posted the detailed answer on another thread with the same

Can't use public class in my web service

核能气质少年 提交于 2019-12-19 10:44:06
问题 Why i can't use the following public class : namespace OrganizerUI.App_code { public class Employee { private string text; public string Text { get { return text; } set { text = value; } } } } in my web service : 回答1: Often (always?), code files that are added to the Visual Studio App_Code directory are not set by default to compile even if they are .Net code. They are set to "Content" which means they are included in the output only. If you right-click the file and choose "properties" you

how do you pass an array string[] to a Web Service via Jquery?

我是研究僧i 提交于 2019-12-19 10:03:26
问题 here's my code: var ids = $.map($("#container-1").children(), function(n, i) { return n.id; }); $.ajax({ type: 'POST', url: 'Loader.asmx/Active', data: "{'divs':'" + ids + "'}", contentType: 'application/json; charset=utf-8', dataType: 'json', success: function(msg) {} }); 回答1: Javascript; var ids = $.map($("#container-1").children(), function(n, i) { return n.id; }); $.ajax({ type: 'POST', url: 'Loader.asmx/Active', data: { divs: ids.join("|") }, contentType: 'application/json; charset=utf-8

Invalid JSON primitive: id

谁说胖子不能爱 提交于 2019-12-19 05:20:35
问题 I cannot get the following function to work properly. It seems to be serializing it wrong. This is about the 5th iteration of different data variants. I was originally just doing data: {'id': id} like I do at work with WCF, but with the ASMX it just isn't working. It looks like it's serializing teh data as id=1234 instead of id:1234, but I'm fairly new to this. Any help would be appreciated. Oh, and I can call the service directly in the browser and it returns the data properly so I know it's

How to change the address location of my wsdl

萝らか妹 提交于 2019-12-19 04:14:49
问题 My wsdl put a wrong domain in address location, How to fix it? - <wsdl:service name="XWebService"> - <wsdl:port name="XServiceSoap" binding="tns:XWebServiceSoap"> <soap:address location="https://machine.wrongdomain.com.br/webservices/MapleStoryWebService.asmx" /> </wsdl:port> - <wsdl:port name="XWebServiceSoap12" binding="tns:XWebServiceSoap12"> <soap12:address location="https://machine.wrongdomain.com.br/webservices/XWebService.asmx" /> </wsdl:port> - <wsdl:port name="XWebServiceHttpGet"

Connecting to an asmx webservice with WCF through a proxy

隐身守侯 提交于 2019-12-19 04:01:48
问题 Sorry answer found while typing I am trying to connect to an external webservice that requires username/password authentication through a proxy. I am using Visual Studio Express 2008 to generate a service reference I have connected to the same webservice using a web reference.We only had to set a larger timeout because it takes a long time to finish. I have connected to another webservice that does not require username/password authentication with a generated service reference and some

What is the difference between the Visual Studio Options: ASP.NET Web Service and WCF Service

随声附和 提交于 2019-12-18 17:15:21
问题 I see that there are two options that I know can be used in web services... WCF obviously, and ASP.NET Web Services. What's the difference? I just started picking up WCF recently and had a little exposure to web services in the past, but I'm certainly not an expert. 回答1: it is quite easy to know the differences. ASP.NET Web Method is called ASMX [because of the file extension] (check 4GuysFromRolla about this, they have a good tutorial) This technology makes you expose methods as a Web

How to format JSON for asp.net webmethod that takes class parameter

若如初见. 提交于 2019-12-18 09:18:30
问题 I have the following webmethod on my asp.net code behind page: [WebMethod(EnableSession = true)] public static bool SaveFailureData(SimpleFailureData data) { } SimpleFailureData is defined as the following: public class SimpleFailureData { public int Id { get; set; } public string Comments { get; set; } public double Score { get; set; } public double Adjustment { get; set; } public List<ShutdownData> ShutdownData { get; set; } } public class ShutdownData { public int Id { get; set; } public

Why can't I expose an interface in a .NET asmx web service?

陌路散爱 提交于 2019-12-18 05:56:04
问题 I have a .NET web service (using asmx...have not upgraded to WCF yet) that exposes the following: public class WidgetVersion1 : IWidget {} public class WidgetVersion2 : IWidget {} When I attempt to bind to the web service, I get the following serialization error: Cannot serialize member WidgetVersion1 of type IWidget because it is an interface. I have tried adding various attributes to the IWidget interface ( XmlIgnore , SoapIgnore , NonSerialized ), but they are not valid on an interface.