SOAP and HTTP Services within the same ASP.Net Project - asp.net

I have an existing web service project that is using SOAP messages to communicated back and forth. I have just created what should be an HTTP service called "AJAXWebServices" that has an attribute over the service class of "[System.Web.Script.Services.ScriptService()]". I want this service to utilize HTTP POST/GET and the other services in the project to continue utilizing their SOAP. The AJAXWebService works fine if the ".asmx" file is in the local project but when I publish it and then make a web reference to it, and I set the service path of my ajaxToolKit:AutoCompleteExtender to "HTTP://server/folder/AJAXWebService.asmx" the page loads and when I start typing it will make the request but return an entire page of HTML instead of just the autocomplete words. It freezes my I.E. while its parsing all the XML. What can I do to fix this?

Related

Call ASP page via Web API

I'm working on a legacy ASP classic application. This application also supports an API, written in C# using Web API 2.
I'd like to add functionality to this API that will consume a request (as a resource - which will contain data need to satisfy a workflow), validate that request, and inside the API controller, generate a new request to an ASP page (the workflow is quiet complicated, so rather than re-write that logic, re-using the ASP page provides better business value).
Ideally I'd like to wait for the response inside the controller, and then pass back an Action Result (like a 204) to the consumer of the API.
The idea here is to hide the response of the ASP page, and return something simple to the consumer.
I know how to structure the URL somepage.asp?p1=help&p2=me, however I'm not sure how to create it as a request, execute it, and then consume the response within the API controller.
Is it even possible?

How to check if a request for static file is passing through ASP.NET pipeline in ASP.NET MVC

I would like to know if there is any way I can check if the request for static files like images/css etc is handled from asp.net pipeline or not.
I have set runAllManagedModules=false in web.config and added ignore routes as well.
The load times have come down. Which indicates that the requests are probably not passing through the asp.net pipeline.
However, is there a way I can ascertain the same?
Browsers i Used: IE/ Firefox
If request goes through ASP.NET request pipeline, it should call all the registered http-modules.
Add custom http-module (if you don't have one).
Put breakpoint inside.
Run app in debug mode.
Initiate request of any static content.
If breakpoint is reached, request probably goes through ASP.NET pipeline. To make sure, you can check the url of the request in debug mode.

ASP.NET Web Service - Log SOAP XML

I have an ASP.NET asmx web service running on IIS.
A client is trying to consume the service, and I can see (after a rebuild) that the Global.asax Application_Start is getting hit from his attempt... but the specific function is not getting hit.
This link
Getting RAW Soap Data from a Web Reference Client running in ASP.net gives a "solution" for what I'm trying to do, but it didn't work.
I placed the above link's suggestion in my web.config, but no log file is generated even when I successfully call the service myself.
If you're looking to trap request/response on the client side, you can connect to ASMX webservices using WCF-style generated proxies just by using a "Service Reference" rather than a "Web Reference", then follow the WCF tracing you linked to for raw data, as well as using System.ServiceModel.MessageLogging for SOAP-specific stuff. Keep in mind that:
the maxdatasize attribute for System.Net will truncate the data logged, so pick a bigger number if your request/responses are larger. Use maxSizeOfMessageToLog with System.ServiceModel.MessageLogging.
remove the raw ascii/hex and only show the xml with tracemode="protocolonly" in the <source name="System.Net"> element
But if you want to trap requests on the server side (i.e. from within your ASMX webservice) you can try the suggestion here, which is to just read the data out of the request stream in Application_BeginRequest and probably also the response stream in Application_EndRequest.

TransferRequest vs Transfer in ASP.Net

I have gone through the links mentioned below,
iis forum and HttpModules & Server.Transfer / Server.TransferRequest / RewritePath problems. but unable to catch the concept behind these transfer methods.
How are they works? And which one is preferred in different situation?
Can someone explain me TransferRequest vs Transfer methods for server side transfer in asp.net and its roles?
Thanks in advance
HttpServerUtility.Transfer Terminates execution of the current page and starts execution of provided URL.
This basically maps and executes a new ASP.NET Page (or serves a static file) corresponding to the url provided. It does this in-place in the current request pipeline, without applying new configuration to the new url, or re-running IIS modules for the new url. Because of this, its very fast, but it also prevents a lot of scenarios that are possible with TRQ.
HttpServerUtility.TransferRequest Performs an asynchronous execution of the provided URL.
This is a full IIS child request under the covers, which allows it to re-run the entire request pipeline for the new request as if it was a separate request, getting the correct configuration for it, and running all of the normal IIS modules including authentication, authorization, etc. For example, IIS will apply the authorization rules for the new url, as opposed to the previous url.
TransferRequest re-runs the entire request pipeline as if it were a separate request. This means that IIS and ASP.NET modules are re-applied; authentication and authorization rules for the new URL will be honored. Note that TransferRequest requires the integrated pipeline mode of IIS 7+, and the transfer can be to an ASP page or another resource like an XML file.
Transfer transfers execution from one ASP page to another ASP page on the server. Unlike TransferRequest, IIS and ASP.NET will NOT verify that the current user is authorized to view the resource delivered by the Transfer method. If you need to force reauthorization, and integrated pipeline mode is not an option, call Redirect instead of the Transfer method. Redirect triggers a client-side redirect so that the new request will be subjected to all authentication and authorization logic of IIS and ASP.NET.

How to show soap request xml for a web service call?

I am using a web method of a company's web service.
This web method requires one parameter when calling it:
CompanyOpereations srv = new CompanyOperations();
srv.getCustomerInfo(input);
How can I see my soap request xml when calling this method?
How do you want to see it? If it's inside the code; I don't know. (Un)Fortunately .NET does a pretty good job of hiding it for the developer.
However, if you just want to debug the calls and nothing else: try Fiddler. It will show you the Request/Response (including headers and everything else) for the webservice calls. This is what we use for debugging webservices. But you can use it for everything that uses the HTTP protocol for communication.

Resources