0

In tridion, I am working on a customization at the component presentation level. My exact task would be to add an extra tab containing 2 text fields under the tab on the right side pane when we click on a component presentation in a page. The data from these fields are stored and retrieved from the AppData table.

For this, we have a JS file which calls a method in web service call (.svc.cs file) which in turn would process the data and store it in AppData table. My issue is I am unable to debug whether the service call is getting executed or not. I have placed alerts before and after the call in the JS file and they are getting executed but still the service call method is not getting executed as I can see no data is entered in the DB. I have tried writing log statements inside the method I am calling from JS file but the logs are not getting generated. I am unable to decide where it is getting stuck or how I should debug.

Below is the line in JS file which calls the webservice method:

    alert("entered");
    *Namespace*.Process(selection.getItem(0), "fighting for freedom");     
    alert("completed");

This process method is in a .svc.cs file as below:

 public void Process(string pageID, string content)
    {
        try
        {

            WriteLog("Entered Process");
            WriteLog("Page ID : " + pageID);
            WriteLog("Content : " + content);
            readOptions = new ReadOptions();
            channel.Impersonate(Tridion.Web.UI.Core.Utils.GetUserName());
            IdentifiableObjectData oD = channel.Read(pageID, readOptions);
            Logger.WriteWarning("Calling StoreInAppData Method", ErrorCode.GENERAL);
            StoreInAppData(pageID, content);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            if (channel != null && channel.State != CommunicationState.Closed)
            {
                channel.Close();
            }
        }
    }

We have used a local method Writelog to generate logs and also tried the Tridion Logger.WriteWarning. Both do not generate any logs. Does this mean the call from the JS file is never reaching the method for some reason? If the method is not getting called, why is the second alert alert("completed"); coming up?

Thanks in advance for you replies!

  • I would check IIS log and see if it gets hit at all. – Hao Peng Apr 9 '14 at 6:56
  • @Hao Peng: Agreed! I tried inserting log statements inside the web service call method and the logs are not getting generated. From this I can only assume the method is not getting hit, however, the alerts before and after the method call are executing and not sure why this method call is an issues. – Keirthana Apr 9 '14 at 7:00
  • maybe the ws endpoint in your js isn't set correctly, or maybe any firewall/proxy is blocking things? you might want to put more info in your alert? Although this doesn't look like a tridion-related question to me. – Hao Peng Apr 9 '14 at 7:07
  • Checked the ws endpoints and it's fine. I think the web service method is not getting hit for some other reason. I try to debug with alerts for the JS functionality and IIS log on the svc.cs file functionality. – Keirthana Apr 9 '14 at 8:17
4

To debug it on the server, you need to attach to the w3wp.exe process that is hosting the web service. To debug it on the client, you can either set breakpoints in the development tool of your browser or (more reliably) add a "debugger" statement to the code where you want to start debugging.

Without knowing how you are calling the web service method, there isn't much more I can suggest. If you need more help, perhaps you could post the code or some more information about how you are calling the service?

| improve this answer | |
1

I presume you are calling wcf in an asynchronous way in which case the call following your wcf request would execute as expected even if the request failed

You might want to add parameters for OnComplete and OnError event handlers in your JavaScript code (when calling Process method) and output the error code from OnError handler.

| improve this answer | |
1

The method Hao Peng suggested was useful. The call of web service method had to be changed to pass parameters like a handler for the functionality to work properly and OnComplete and OnError in order to debug. The asynchronous call was the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.