.Net Windows Form Client. Capturing Request/Response SOAP from ASMX webservice - winforms

before i decided to post this question i went thru several articles and questions in here... none of those seem to be a solution for me.... or i am doing something wrong.
I went thru this article, suggested in this site
http://www.codeproject.com/Articles/38986/Trace-SOAP-Request-Response-XML-with-TraceExtensio?msg=4152902#xx4152902xx
that's not working. Not even the source code i downloaded.
then i found this other article...
http://blog.encoresystems.net/articles/how-to-capture-soap-envelopes-when-consuming-a-web-service.aspx
This is simple.
I have a client (winform)... interacts with a webservice i have no control over, and i need to be able to capture the soap request and response. i followed like 5 tutorials so far, soapextensions, soapattributes, etc, etc... nothing seems to work for me. i have modified app.config, done everything by the book... nothing.
Question... Does anyone have a WORKING example of this? the two examples i found don't work :)
I am using Visual Studio 2010.

Have you tried using tracing in the config file as described in the MSDN articles How to: Configure Network Tracing and Configuring Tracing?

Simply use a "Service Reference" instead of a "Web Reference" then see WCF Tracing.

SOAP extensions need to be registered on the service side (that's why all posts asking you to do configuration inside web.config).
If you want to print out the SOAP messages inside your WinForms client, you will have to call web service in the "raw" way,
http://mikehadlow.blogspot.com/2006/05/making-raw-web-service-calls-with.html
#James demonstrates System.NET tracing, which is another way to see the SOAP messages in an external log file, but that's only useful for troubleshooting, as you won't receive the tracing data inside your client.

Related

How to use google.maps within an asmx web service

I need to calculate distances for some logic within a web service and assume google.maps API is appropriate. Everything I've seen is Jscript and requires a reference to the script in html tags <script>, which does not apply here. A .dll would make things obvious to me, but that does not seem to be available...
How do you access google.maps within a c# .asmx??
You will have to do the same thing that would be done by the JavaScript code you're seeing as examples. You'll want to use the WebClient class or maybe the WebRequest class to do the network I/O, but you've got to send and receive HTTP messages.
"Add Service Reference" won't work, of course.
Note that this problem is not specific to ASMX web services. You would have the exact same issue in a console program or Winforms application.

How to remove time info from WCF messages?

I was trying to set maxclockskew for a secure service being consumed in a Silverlight client.
The things I tried have been summarized in related post
How to fix the WCF maxClockSkew problem in a HTTPS Silverlight application context?
As I also have found no way to do that, now I also want to remove the timeinfos, so that clock-skew validation is skipped. How is it done?
just setting the InclueTimestamp to false didn't work.

Silverlight web service call not even hitting servers

I have a custom proxy class for a single WCF web-service (takes a string in, sends a string back). The asynchronous web service call works great from my Windows Form app. However, when I call it from a test Silverlight app I get an error: Hresult 0x80000012. This error is for Extension Attributes on files I believe... Go figure.
Using Fiddler I can confirm that no traffic is making it to IIS which is hosting the service, so it isn't the usual cross-domain restriction issue. I've tried using both "localhost" (which works in the Windows Forms app) and a name defined in my hosts file just in case "localhost" was causing the problem.
I've tested it by making the async call from the UI thread and also from a thread-pool queue item with the same results.
The proxy code is basically just simplified down from what the MS proxy generator creates, setting up bindings and settings programatically instead of via config files, and I use basically the same source to compile normal .Net and Silverlight versions of the libraries involved. (Now, the MS proxy code it is based on is from a WCF web service, not from the RIA template code, so maybe there are differences there...)
Four days of fruitless search on this one. Any help or suggestions would be wildly appreciated!
Figured it out. I was using (stupidly) a backslash in part of the URL that I used to set up the service call. Most of the interior parts of the MS code handled that ok and transposed them to forward slashes -- on Windows Forms everything worked seamlessly in fact. However, the Silverlight libraries couldn't handle it and threw the very helpful "HResult 0x80000012" error.
Changing my backslashes to slashes seems to have fixed the problem!

How do I setup a really simple WCF Data service and entity model that works?

Ok this is going to seem really daft but but essentially this is what i'm trying to do in a nutshell ...
http://msdn.microsoft.com/en-us/library/dd465161.aspx
The problem is that when I create the WCF Data Service and browse to it everything looks good at the root level and as soon as I leave the root I get http 500 errors.
I get no decent information on how to fix the error or what went wrong it says "Internal server error" ... not helpful.
So my question is sort of twofold ...
How do I setup a simple WCF Data service that relies on an entity model then bind some simple data to a listbox or something in a WPF client?
but also ...
How do I debug those http 500 errors?
Just for clarification:
I followed the steps here ...
http://msdn.microsoft.com/en-us/library/dd728275.aspx
... to create the model and service.
The root url "http://localhost/Northwind.svc" works fine.
Browsing to "http://localhost/Northwind.svc/Orders" causes a http 500.
This helps a LOT:
Link
Also download fiddler you can use it to monitor requests/responses (See this)
I would start by attaching the debugger to your service when you use your browser to access it.
You might want to try a different client because there usually is a response from a service besides the 500 errorcode, but a browser only shows a 500 error page.

How to do crossdomain calls from Silverlight?

What's needed to succesfully make a crossdomain call from Silverlight?
If I understand your question correctly you would need to have a clientaccesspolicy.xml file in the domain web root of the server that you wish to call (ie www.example.com/clientaccesspolicy.xml) that defines that it is ok for services from other domains to call services on that domain.
Read the How to Make a Service Available Across Domain Boundaries MSDN article for more detailed information.
See Jon Galloway's blog post on this as well
http://weblogs.asp.net/jgalloway/archive/2008/12/12/silverlight-crossdomain-access-workarounds.aspx
Intellisense helper file and walk-through: http://silverlight.net/learn/learnvideo.aspx?video=47174
Maybe also check out JSONP http://www.west-wind.com/weblog/posts/107136.aspx for example this is how you can get Twitter updates in JavaScript on the client side even though Twitter is on a different domain than you web page.

Resources