Link to home
Avatar of Rob Gaudet
Rob GaudetFlag for United States of America

asked on

ASMX Service Client Debugging

I am testing a client who's supposed to connect to my .asmx web service with a single method called PostData.

The client code being used is also used for other web services, however, it does not reference any methods.
So I'm assuming the other services this client publishes too are web services that don't expose any methods.

QUESTION 1) Is is possible to create web services that don't expose methods?

I had them send me an example of the code to test out myself, I've copied it below. When I try running this... I get a "The remote server returned an error: (500) Internal Server Error.".

I would like to debug this inside of the web service, however I am not sure how to since it doesn't ever load up the exposed method.

QUESTION 2) ANY IDEAS?


string returnString;
			var request = System.Net.WebRequest.Create("https://-------/Services/DataPushService.asmx") as System.Net.HttpWebRequest;
			var messageString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><XML xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">DATA HERE</XML>";
			request.Method = "POST";
			request.ContentType = "text/xml";

			request.Accept = "Accept"; // options.Communications.HttpAcceptHeader; 
			request.KeepAlive = false;
			request.ServicePoint.Expect100Continue = false;

			request.Headers["Authorization"] = "Basic WebServiceTest:miller69";

			using (var requestStream = request.GetRequestStream())
			{
				using (var requestWriter = new System.IO.StreamWriter(requestStream, Encoding.UTF8))
				{
					requestWriter.Write(messageString);
				}
			}

			using (var response = request.GetResponse())
			{
				using (var responseStream = response.GetResponseStream())
				{
					if (responseStream != null)
					{
						using (var responseReader = new System.IO.StreamReader(responseStream, Encoding.UTF8))
						{
							returnString = responseReader.ReadToEnd();
						}
					}
				}
			}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Rob Gaudet

ASKER

The client is driving the boat here... they don't want to base-64 encode the auth. info and I don't want to rock it. As for the Accept header, I'll make that adjustment and see how it goes.
Yeah, changed the Accept header to the proper text but still getting this error --> "The remote server returned an error: (500) Internal Server Error.".
You need to have a look at the server logs to determine the correct error (typically include error details and hopefully ad stack trace that cold guide you to find out what the problem is)