We help IT Professionals succeed at work.

Anyway to see which Web Services method is being called?

Medium Priority
146 Views
Last Modified: 2019-04-26
I'm working on a Windows Forms project and it calls Web Services. This is how the project is setup (my new job)

1. The Windows Forms solution
2. Web Services solution
3. Windows Forms solution has references to the Web Services . Screenshot below (not the best naming convention, I know)
e1.png
4. I downloaded Fiddler to see if I can see what Web Services method is being called. I see some logging but not Web Services.

Anyway I can see  which web services method is being called?
Comment
Watch Question

Fractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
By method, I'm guessing you mean the POST or GET method.

If this is correct, you'll refer to your Web server logs.

Each request will log the request type, if your logging is setup to log request method.
CERTIFIED EXPERT

Author

Commented:
I'm running the code locally. Where should I look? (it's a desktop)
CERTIFIED EXPERT

Author

Commented:
I have IIS and hosting the WS there, locally. IIS logs?
gr8gonzoConsultant
CERTIFIED EXPERT
Commented:
If you're connecting to the web service via HTTPS, then Fiddler won't show you anything by default except the SSL handshake/tunnel (the "CONNECT" lines). If you don't see one of those CONNECT lines when you try to make the web service call, then either:
A) Fiddler isn't started and/or doesn't have capturing enabled
B) you're not making the call
C) your code isn't using the default system proxy (usually this is automatic unless you've specified a separate or blank proxy)

If you DO see the CONNECT line in Fiddler but nothing else, then you just need to enable HTTPS decryption in the Fiddler options (there's a separate "HTTPS" tab for this, and it will prompt you to install a special "Do Not Trust" certificate to make it work).
CERTIFIED EXPERT

Author

Commented:
Hmmm, let me see. This is an old code from 2002 sometime.  Let me take  a look.
Chinmay PatelChief Technology Ninja
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
Hi Camillia
,
First and foremost, Windows Forms are event driven so if you setup breakup points at appropriate events ( For example, Form_Load, Button_Click) you will eventually see which service is being called at what time. Also, the references which are added to the list, I have a hunch that they are just duplicated all over the place (You can verify them once all other problems are sorted out and remove if they are not serving any purpose).

Regards,
Chinmay.
CERTIFIED EXPERT

Author

Commented:
Yeah, Chinmay , that's what I saw in the click event... the reference to the web service method. I was able to find it. I wanted to grab the parameters that get passed along with the url. Then, I wanted to run it in the browser and put a debug step in the web services code.
Chinmay PatelChief Technology Ninja
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
You can put a breakpoint in web service code as it is. Once you have find the method you want to debug, keep your cursor on the method and press F12, this should take you to the method in Web Service's code base (If the projects are configured properly), if not it will take you to the metadata and you will have to manually find the method from the Web service code base.

Anyways, once you have the method's entry point you can setup break points appropriately.
CERTIFIED EXPERT

Author

Commented:
Let me try that. I think it took me to the meta data but I'll try again.

I'll post back tomorrow,  if not today.
CERTIFIED EXPERT

Author

Commented:
then you just need to enable HTTPS decryption in the Fiddler options
That was correct. I turned it on and I see the call.

Also, the references which are added to the list, I have a hunch that they are just duplicated all over the place
Ha, yes, Chinmay, how did you know? :)

Let me try the F12 and see if I can step into the actual Web Services code. I'll post back.
Chinmay PatelChief Technology Ninja
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Ha, yes, Chinmay, how did you know? :)

I didn't have a life back then... I know how people behave with computers... I was used to be more comfortable with machines and they'd talk to me .. they'd tell me horrible tales of wannabe Developers who would keep adding references as they move from machine to machine and sometimes just 'cause the port was blocked('cause they left the IISExpress running... the list is long, you see)
*hides face* :P
CERTIFIED EXPERT

Author

Commented:
Haha, thanks :) let me see if I can step into this web services code. I'll post back.
CERTIFIED EXPERT

Author

Commented:
I can step into the Web Service method but I don't understand why I can't step into one section. If we can't figure it out, it's ok.

1. Code (not the Web Services code) has this line

DebitCardWebService.Debit_Card_Service ws = ....
 ws.Url = WebserviceURL.DataCenterWebService(ws.Url, global::WindowsReportingApplication.Properties.Settings.Default.SSLEnabled, Properties.Settings.Default.RemovePort);

 ws.UpdateGameListByFilers(Authorize.MAC_IDs, ds); //this calls the WS method

Open in new window


2. I F11 and it goes to WS --> method UpdateGameListByFilers

3. So far so good

4. I can't step into the line I've marked

...
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter_GameListByFilters;
....
this.sqlDataAdapter_GameListByFilters = new System.Data.SqlClient.SqlDataAdapter();
...
[WebMethod(Description = "update List the games")]
		public bool UpdateGameListByFilers(string[] mac_id, GameListByFiltersDataSet ds)
		{
			try
			{
				...
				this.sqlDataAdapter_GameListByFilters.Update(ds, "ST_GameListByFilters_SDS"); //*** can't step into this

				return (true);
			}
			catch (Exception ex)
			{
				...
			}
			finally
			{
				...
			}

		}

Open in new window


5. This is what I want it stop at. I see this code in the same file as above code. I  put a debug step but it doesn't stop there. Below code does get executed because I have SQL Profiler on and I see the stored proc being called but don't know why it doesn't stop there in the code

this.sqlUpdateCommand.CommandText = "dbo.ST_GameListByFilters_Update";
			this.sqlUpdateCommand.CommandType = System.Data.CommandType.StoredProcedure;
			this.sqlUpdateCommand.Connection = this.sqlConnection1;
			this.sqlUpdateCommand.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] {
            new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((byte)(0)), ((byte)(0)), "", System.Data.DataRowVersion.Current, null),
            new System.Data.SqlClient.SqlParameter("@Tag", System.Data.SqlDbType.BigInt, 8, "Tag"),
            new System.Data.SqlClient.SqlParameter("@Description", System.Data.SqlDbType.NVarChar, 30, "Description"),
            new System.Data.SqlClient.SqlParameter("@AssetTag", System.Data.SqlDbType.NVarChar, 20, "Tag"),
            new System.Data.SqlClient.SqlParameter("@CashPlayPrice", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((byte)(18)), ((byte)(0)), "Cash Play Price", System.Data.DataRowVersion.Current, null),
            new System.Data.SqlClient.SqlParameter("@TokenPlayPrice", System.Data.SqlDbType.Int, 4, "Token Play Price"),
            new System.Data.SqlClient.SqlParameter("@AllowTimePlay", System.Data.SqlDbType.Bit, 1, "Allow Time Play"),
            new System.Data.SqlClient.SqlParameter("@AllowCreditPlay", System.Data.SqlDbType.Bit, 1, "Allow Credit Play"),
            new System.Data.SqlClient.SqlParameter("@EmpID", System.Data.SqlDbType.Int, 4, "EmpID"),
            new System.Data.SqlClient.SqlParameter("@LTstamp", System.Data.SqlDbType.SmallDateTime, 4, "LastModified"),
            //new System.Data.SqlClient.SqlParameter("@Closed", System.Data.SqlDbType.Int, 4, "Status"),
            new System.Data.SqlClient.SqlParameter("@Closed", System.Data.SqlDbType.Int, 4, "Status")

        });

Open in new window

gr8gonzoConsultant
CERTIFIED EXPERT
Commented:
If the debugger is stopping on other steps within the same project but is not stopping on the breakpoint you've placed in that section you mentioned, then that means that that code is not being run. If the SP is being executed, there might be some other place where it's being executed. Keep adding breakpoints between this SqlClient code and the last breakpoint that DOES get hit to find out where the execution is going.
CERTIFIED EXPERT

Author

Commented:
Let me run the web services code in debug mode as well. I get to the break point in the right place. I'll dig deeper.
Chinmay PatelChief Technology Ninja
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
Another way to check out the entire flow is to watch Call stack and see if it is branching somewhere else and calling that SP.
CERTIFIED EXPERT

Author

Commented:
Yes! Didn't think of that.
CERTIFIED EXPERT

Author

Commented:
As always, thanks

Explore More ContentExplore courses, solutions, and other research materials related to this topic.