Error handling with Javascript-enabled WCF?

Is there documentation on how to use the callback functions in a WCF Service that is exposed to Javascript? I'm interested in getting information from the FailureCallback as to why my method isn't firing.

In other words I have the follwoing JavaScript code:

     function getWCF_RowNumber(parentID) {
              logEvent("<strong>Busy</strong>: Please wait while lower grid is refreshed...");                  
              var service = new ajaxTest();
              service.Vendor_GetParentRowNumber(parentID, moveBottomGridToRow, wcfFailCallback, null);
          }

How do I implement wcfFailCallback?

Answers


I'm assuming you're using ASP.NET AJAX and not jQuery or some other 3rd party JavaScript library.

The ASP.NET AJAX failure callback takes a single parameter. From MSDN, a sample failure callback would look like this:

function wcfFailCallback(error)
{
    var stackTrace = error.get_stackTrace();
    var message = error.get_message();
    var statusCode = error.get_statusCode();
    var exceptionType = error.get_exceptionType();
    var timedout = error.get_timedOut();

    // Display the error.    
    var RsltElem = 
        document.getElementById("Results");
    RsltElem.innerHTML = 
        "Stack Trace: " +  stackTrace + "<br/>" +
        "Service Error: " + message + "<br/>" +
        "Status Code: " + statusCode + "<br/>" +
        "Exception Type: " + exceptionType + "<br/>" +
        "Timedout: " + timedout;
}

So the wcfFailCallback function takes an error parameter, which has a number of properties that provide you information about what failed.

The full article on MSDN is here. It goes into some decent amount of details about how to hook up WCF services to ASP.NET AJAX clients.

I hope this helps!! If there are other questions or if I didn't fully understand your question, let me know and I'll update my answer accordingly.


Need Your Help

Password Encryption Using opencart database for sitewide login

php encryption opencart

Hello hopefully I can be pointed in the right direction and gain some clarity as I am now confused.

How can I make Box2D create only one instance of a body?

c++ box2d testbed

I only called the body->CreateFixture(&amp;fixtureDef) once but the Testbed keeps on creating bodies. Here is my code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.