473,382 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Debug webservice

Hi

I have a VS2005 c# solution which includes a webservice and a windows
application which uses the webservice.

How do I "debug" into the webservice from the application?

I can for example debug/attach to aspnet_wp.exe and access the webservice
from a browser - and there I can hit breakpoints in the webservice (but
unfortunately not access the more complex methods in my webservice).

But I can't work out how to achieve the same from my windows application.
Thanks,
Peter
Jun 27 '07 #1
2 2269
How do I "debug" into the webservice from the application?
On a related note, how would one get a look at the soap packets (request and
response) when using the wrapper classes generated from a wsdl? The wrapper
classes try to hide the conversation and it would be nice to see the
specifics of the question.

And in my case, I'm talking to a web service written in php that doesn't
seem to give proper soap error responses, so I really need to see what's
getting sent back.

Thanks
Mark

Jun 27 '07 #2
One options for getting at the Soap message content is to use a "universal"
client such as the System.Net.HttpWebRequest object to send and recieve raw
Soap (see the second post to WebClient generates exception: header must be
modified using ... 6/22/07). If you have a WCF client to your web service,
you can add the following local to the class containing the client object
creation and web service call:

Public Shared results As String

Private Class MyBehavior
Implements ServiceModel.Description.IEndpointBehavior

Public Sub AddBindingParameters(ByVal endpoint As
System.ServiceModel.Description.ServiceEndpoint, ByVal bindingParameters As
System.ServiceModel.Channels.BindingParameterColle ction) Implements
System.ServiceModel.Description.IEndpointBehavior. AddBindingParameters

End Sub

Public Sub ApplyClientBehavior(ByVal endpoint As
System.ServiceModel.Description.ServiceEndpoint, ByVal clientRuntime As
System.ServiceModel.Dispatcher.ClientRuntime) Implements
System.ServiceModel.Description.IEndpointBehavior. ApplyClientBehavior
clientRuntime.MessageInspectors.Add(New MyInspector)
End Sub

Public Sub ApplyDispatchBehavior(ByVal endpoint As
System.ServiceModel.Description.ServiceEndpoint, ByVal endpointDispatcher As
System.ServiceModel.Dispatcher.EndpointDispatcher) Implements
System.ServiceModel.Description.IEndpointBehavior. ApplyDispatchBehavior

End Sub

Public Sub Validate(ByVal endpoint As
System.ServiceModel.Description.ServiceEndpoint) Implements
System.ServiceModel.Description.IEndpointBehavior. Validate

End Sub
End Class

Private Class MyInspector
Implements ServiceModel.Dispatcher.IClientMessageInspector

Public Sub AfterReceiveReply(ByRef reply As
System.ServiceModel.Channels.Message, ByVal correlationState As Object)
Implements
System.ServiceModel.Dispatcher.IClientMessageInspe ctor.AfterReceiveReply
results = vbCrLf
results &= "=====AfterReceiveReply================"
results &= vbCrLf
results &= reply.ToString
results &= vbCrLf
results &= "======================================"
results &= vbCrLf

End Sub

Public Function BeforeSendRequest(ByRef request As
System.ServiceModel.Channels.Message, ByVal channel As
System.ServiceModel.IClientChannel) As Object Implements
System.ServiceModel.Dispatcher.IClientMessageInspe ctor.BeforeSendRequest
Return Nothing
End Function
End Class

The calling code would do the following to invoke this behavior assuming the
service object is name WsClient and you have a Textbox control named
txtResults:

WsClient.Endpoint.Behaviors.Add(New MyBehavior)

''' code to invoke your service goes here

'Display the response from the web servive:

txtResults.Text &= results

''' rest of your code...

Hope this helps!
Jun 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DKode | last post by:
Ok, Maybe there is an easier way to do what it is im trying to do. Let me explain how I have the solution setup first. Basically, I am having alot of difficulty debugging on my local machine and...
1
by: John Nelson | last post by:
I seem to only be able to use a webservice after I compile a project and run the executable code. When I try to run the code in Visual Studio 2003 in debug mode it always hangs on the "this.Invoke"...
9
by: mekim | last post by:
Hi All, I have a solution that has a asp.net app project and webservice project in it When I debug the asp.net app...and then terminate it...the webservice is still live...and aspnet_wp.exe is...
2
by: wcchan | last post by:
Hi, We set debug="false" at web.config of a WebService for performance sake. We found that after set, the web service request will sometimes got a timeout exception. Would anyone tell me how long...
0
by: rob | last post by:
I am trying to debug a webservice by steping into a web method called from a windows form project. The strange thing is that sometimes it works but often it does not. When it does not work I get...
1
by: Epetruk | last post by:
Hello, In VS2003, I used to have two solutions - a debug and release solution. Each solution had a webservice project and several other class library projects. The webservice project...
5
by: perspolis | last post by:
Hi all I have a webservice that I want to debug it line by line.. I enabled the Debug option in WeConfig. but I can't debug that and when I set a break point for it,that dosen't work .. thanks...
1
by: bixbarton | last post by:
Running C# .NET 1.1 I'm experiencing a weird oddity. We have a client app which access the webservice at http://www.test.planningportal.gov.uk/soap/servlet/messagerouter If I start the...
4
by: John Sheppard | last post by:
Hello all, I have an application written in VB.Net that comsumes a webservice. We are having issues with speed. I have not ruled out a webservice problem, and this was my first guess. However...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.