asmx

Consume WCF service using add web reference and add a soap header

不想你离开。 提交于 2019-12-06 11:11:29
I have a WCF 4 web service that checks for a soap header. This works fine with a WCF client but I have a customer that needs to use the old web reference from their app. How do you consume a WCF service using Add Web Reference and the add a SOAP header in the client? Lets keep it simple and say I want to pass a country in a header, so the header name will be country. Thanks, Paul You need to expose your endpoint across the basicHttpBinding in order to interoperate with pre .net 3.0 clients. UPDATE Does this help? http://msmvps.com/blogs/paulomorgado/archive/2007/04/27/wcf-building-an-http-user

Webservice method to call a url

↘锁芯ラ 提交于 2019-12-06 09:49:19
I have a webservice, it has its wsdl and everything works fine when I make a call to my web service. What I want to do now is call a url from somewhere within my web service method. In c# code behind I can do it something like this: Response.Redirect("Insurance.aspx?fileno1=" + txtFileNo1.Text + "&fileno2=" + txtFileNo2.Text + "&docid=" + Convert.ToString(GridView1.SelectedDataKey[2])); but the Response.Redirect option is not available on the asmx page. Is something like this possible? If so then would be grateful in anybody can show me how. I've tried searching everywhere but can only find

Get IP Address of the requested client (Soap message)

谁说我不能喝 提交于 2019-12-06 08:39:31
问题 I builded a ASMX Service and in the code that process an Error Log that comes from ELMAH. I add into the database all the fields and I add some more, one is the IP Address of the requested client... But I can't (please read, don't know how to) get that... I'm used to string ipAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ipAddress == "") ipAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; But off course here it does not apply because it

web service could not create type error with type in the GAC

喜欢而已 提交于 2019-12-06 08:17:35
Stuck with an unusual problem, would seem that I love doing things that's not very common. I have a composite control, that checks to see if a given web service file exists in the root of my application, if it does not, it creates the file with the necessary directive in the markup to ball rolling, something like: <%@ WebService Language="C#" Class="Company.Project.Assembly.ClassName" %> which in turn, gets saved to the output. Once this step has been completed, a recycle on application pool is initiated to get the new page rendered within IIS. My assembly that the directive points to, is GAC

How to Bind jqGrid with asmx webservice C#

感情迁移 提交于 2019-12-06 07:46:22
问题 Please i need some help in how to bind jqGrid with asmx webservice C# , i found some topics in how to convert asmx webservice to JSON but it's not clear with me Regards 回答1: First of all you should define WebMethod which will provide the data for the jqGrid. If you plan to implement server side sorting and paging the webmethod should have at least the following parameters public JqGridData TestMethod (int page, int rows, string sidx, string sord) where JqGridData class will be defined for

Is this supposed to work this way?

白昼怎懂夜的黑 提交于 2019-12-06 07:24:16
问题 I have this code up on my server here (Yes I known ASMX is a bad idea but WCF doesn't work at all for some reason): <%@ WebService Language="C#" Class="Test" %> using System.Web; using System.Web.Services; [WebService(Namespace = "http://smplsite.com/smplAccess")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Test : System.Web.Services.WebService { State s; public Test() { s = (Session["foo"] ?? (Session["foo"] = new State())) as State ; } [WebMethod(EnableSession

ASMX file download

吃可爱长大的小学妹 提交于 2019-12-06 06:27:35
问题 I have an ASMX(no WCF) webservice with a method that responses a file that looks like: [WebMethod] public void GetFile(string filename) { var response = Context.Response; response.ContentType = "application/octet-stream"; response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); using (FileStream fs = new FileStream(Path.Combine(HttpContext.Current.Server.MapPath("~/"), fileName), FileMode.Open)) { Byte[] buffer = new Byte[256]; Int32 readed = 0; while ((readed = fs

What are all the valid ASP.NET Webmethod return types?

对着背影说爱祢 提交于 2019-12-06 05:43:49
Can my webmethod only return strings like I see in all the asp.net site examples? asp.net Webmethods can return any serializable data type. John Saunders Assuming that this question is about the legacy ASMX web service technology, see Data Types Supported by XML Web Services Created Using ASP.NET . Be sure to take note of where it says: This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation (WCF) . As far as I know, you can pretty much return any .NET class, including anonymous types. I've

How do I include my own wsdl in my web service in C#

泄露秘密 提交于 2019-12-06 02:47:52
问题 I have a .wsdl file that my web service (old asmx style) must implement. That is taken care of. When I publish the web service you can call it with ?wsdl parameter to get a generated wsdl. How do I include my .wsdl file so that is the one that is returned instead of the generated one? Is it possible to do with an attribute in my web service class? 回答1: Is it a given to stay with "old-style" ASMX? Or could you move up to WCF? That's really the most current webservice offering by Microsoft, and

Catching a SoapException thrown by a WebService

耗尽温柔 提交于 2019-12-06 01:56:54
问题 I wrote the following service : namespace WebService1 { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class Service1 : System.Web.Services.WebService { [WebMethod] public string Test(string str) { if (string.IsNullOrEmpty(str)) throw new SoapException("message", SoapException.ClientFaultCode); else return str; } } } And a basic application to test it (one button calling the Test