I am trying to debug a code where a web service was being consumed by both .NET and Java application. I was in a scenario where I had to generate the raw request and response xml file and share it with the java developer. Usually, we can simply call the objects / methods in .net and so how can we view the raw request and response files when calling the web services. To work on this scenario, we can take advantage of System.Web.Services.Protocols.SoapExtension in .NET and create our own class by implementing the SoapExtension class.
April 24, 2014
March 30, 2014
I can do lot of cool things with asp.net but sometimes I don't like the idea of postbacks, specially when working on large pages. Imagine a page with a number of controls and every postback will send the controls data back and and forth and recreate the controls. So, how can I write asp.net and call methods on code-behind from aspx pages without using postbacks.
January 7, 2014
For this example, I will start with the web service. It's going to be asmx service that simply adds and subtracts numbers that it retrieves from the front end. Here's the code for the web service.
On the front end, I have couple of text fields, 1 option field to select to add or to subtract, a button that will trigger the script when clicked and a span element that will display the data. Here's the code for the html front end.
To start with I am calling jquery source file. Next, in the button click handler, I am forming the service url based on the selection. The important bit is this line
Note that a and b are parameter names in the service and I am sending the value of the text boxes. Finally, on success, I am populating the data in the span element. In case, error occurs, for example, if we type in "abc" in the text box or the web service is down, then the error function is fired and the text "Error!!!" is displayed within the span element.
Another thing to note is that the return value in json has .d at the end. This is within the success function as below.
The .d is a wrapper that ensures the payload is a json object.