Best Solution for Tracing/Loging Web Service - asp.net

We have ASP.NET 4.5 web services (asmx) with a lot of projects and classes.
We need to recreate bugs in production enviroment so if a bug is reported we would like to view a log file so we can recreate the bug.
It will be a lot of work to write logger code lines in the solution projects.
Is there any logging add-in/extension that will do the work more rapidly?

We use WCF Message logging. It logs the entire xml that is sent into the web service.
If we have a problem in test or Production, we take the xml, put it into SOAP UI and run it against the web service. This Works well for stateless calculation services, for services that require state you could take a copy of Production to recreate the problem in test.
Here is how you can configure it: https://msdn.microsoft.com/en-us/library/ms730064(v=vs.110).aspx

Related

Calling WCF service from jsp page

I have created a WCF Service and published it to a Windows Server running IIS. In an asp.net web application, I can add a Service Reference to the WCF Service which exposes its methods which I can call. This all works fine.
I need someone who is running a jsp site to be able to call a method in my WCF Service. How can they do that? (I know absolutely nothing about jsp). Presumably they cannot reference my WCF Service within their application in the same way you can within a .net application.
The web services are totally platform independent. Therefore, someone writing in Java should have no problem calling a web service server, regardless if it was written using WCF or another platform. For example, here, here and here you could find some tutorials on how to build web service clients using java. This java code could be called from JSP pages.
If you want to quickly test your web service from the client side, you could use SoapUI. It's a web service client tool developed in java. I am sure you will find it useful.
Hope I helped!

How to call WCF at a scheduled timings?

I have to export data from a database in the form of flat files. I already have an asp.net website which saves data into the db. I am thinking of creating a WCF webservice project as part of the website solution. This WCF webservice will have methods to export flatfiles. I am also planning to create a console app to call this webservice at scheduled times.
I have the following questions:
Once the website is hosted on IIS along with WCF, can the console app call the WCF or WCF has to be hosted separately?
How to debug the process?
is there any better way of doing it?
Once the website is hosted on IIS along with WCF, can the console app
call the WCF or WCF has to be hosted separately?
The console app can call the WCF web service. It does not have to be hosted separately.
How to debug the process?
Ideally, on your own PC. Easy way to do is to launch the WCF Webservice within one instance of Visual Studio and the Console App on another instance of VS. You can put break points on each of the projects and follow the logic
is there any better way of doing it?
There are many ways to do one thing but yours in this case looks good to me.
Your plan sounds fine to me.
If I were doing this I might create a WCF Service with One Way Operations so that the client app is not waiting for a response until the job is complete.
I might use Powershell and a scheduled task to hit the WCF service, or even use the free Pingdom service to hit the service endpoint at intervals.
To debug locally- if the WCF is it's own project make sure it's set as the startup project in VS, then apply break points, run debug and request the endpoint through the browser or Fiddler.

Wsdl, test web service, newbie

I have a few wsdl URLs (e.g. https://location?wsdl). And I need to automate the testing of these web services with asp.net. How can I do that ? I was told that http website request could do this (HttpRequest Class). I don't know much about web services except the basics.
Create a unit test project. Use "Add Service Reference" to reference the WSDLs within this project. Then, just create unit tests to call the service and confirm that the results are as expected.
Note that purists will say these are integration tests, not unit tests, but that's ok. They'll be automated, which is what you were looking for.
Soap UI works great if you can get around the requirement of having to using ASP.NET.
See the tutorial here...
http://www.soapui.org/Getting-Started/your-first-soapui-project.html
If you have to use .NET why can't you just make a proxy class of the webservice using wsdl.exe and then test it with the web service client that's generated from that?

I need advice regarding WCF and n-tier

First off, i'm fairly new to programming, I've built a few asmx web services but I am a little lost regarding how I should set up a WCF web service. I've tried to research this over the past couple days by reading through a lot of the documentation/articles/videos on MSDN but I'm still a confused.
Since my current web services are hosted on a separate box using IIS, from what I understand I need to create a WCF Library, then reference the Library in another WCF App and then host that app in IIS and reference the WCF App from my Front End? Seems like an extra step to me...? Not to mention a pain when developing on my local box.
Any advice or a point in the right direction would be very much appreciated. Thanks!
WCF gives you the option of sharing common assemblies (i.e. so both your service and clients can use the same domain model library), but it's not a necessary step.
You can host a WCF service through ASP.NET, same as ASMX. The "WCF Service Application" project template in Visual Studio configures it this way by default - as a WCF service hosted in IIS.
For the most common scenarios, it's really no different from ASMX. You create a WCF Service application, deploy it to a web server, and add service references in client applications. The importer will automatically generate classes for you, so you don't need to reference any assembly. No extra steps.
If you haven't already, you really should have a look through Microsoft's Tutorial. You'll find the steps very similar to those for setting up an ASMX-based architecture.

How to consume web service in my application

While consuming a web service in my application I have two choices(ref. msdn)
Adding the Proxy Using the WSDL Tool
2.Adding the Proxy Using a Web Reference in Visual Studio
Now what should I choose, 2nd option is very simple and I generally follow that.
I want to know what are the pros and cons of both the options(if any) and ideally what should I choose?
Thanks.
They essentially achieve the same thing. The second gets the WSDL from the web service and generates the proxy, which requires the service to be online at the time.
Add the reference automaticly when possible, Visual Studio will do everything for you.
Under certain scenarios this is not possible. so you will have to do some manual work, like running the command to generate the proxy class and copying some configuration lines into the web.config manually.

Resources