none
Modify Callouts after Migrating from 3.0 to 4.0

    Question

  • I've callout running on opportunity form which fires when an opportunity form is saved or updated. It worked well in 3.0. recently we migrated the crm 3.0 to 4.0. We were able to make that callout fires after registering the dlls into GAC. Now when the callout is firing, I'm getting few erros with the code. The callout contains the code for logging the errors. From the errors I found that the callout code wasn't able to read the data from entity xml. 

    I'm trying to debug the callout using 'attach process' option in visual studio. But I'm getting error message 'cannot attach to process'. Also I tried to replace the dll with some other test logic. But the replaced dll is not working. I suppose the call out in crm 4.o is not using the dll in the 'assembly folder'. Can anyone help me out here.

    Tuesday, March 23, 2010 6:20 AM

Answers

  • Hi Guys,

    I'm able to resolve the issue ....

    the actual problem is in reading the XML content

    in the callout i wrote the following code to read the data.....

    XmlDocument xdoc = new XmlDocument();                            
    xdoc.LoadXml(entityXml.ToString());              
    //Parse the XML                   
    XmlNode PropertiesList = xdoc.FirstChild; //which gives the first node in the xmldoc.

    this worked very well in the crm 3.0 but giving the 'object referene not found' error in 4.0. I replaced the statement with this.

    XmlNode PropertiesList = xdoc.ChildNodes.Item(1);

    Now it started working..

    INTERESTING...

    I've seen the xml content....and it is like this....

     

    <?xml version....>

    <properties xmlns=....>

    ..

    ..

    </properties>

    xdoc.FirstChild will probably giving the <xml version..> node and thus leading to the problem.....

    IF so...why it worked in CRM 3.0..? Any Ideas...

    • Marked as answer by Bittu.CRM Thursday, March 25, 2010 8:43 AM
    Tuesday, March 23, 2010 10:45 AM
  • VS2003 works with the framework .Net 1.1 and your callout is executed under the framework 2.0 (Indeed, the web site).

    Compile your callout with Framework 2.0 (VS 2005 or 2008), then install remote debugger on the server.

    You should be able to debug your callout


    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    • Marked as answer by Bittu.CRM Thursday, March 25, 2010 8:43 AM
    Tuesday, March 23, 2010 12:19 PM
    Moderator

All replies

  • Please try deploying your plug-in on disk for debugging.
    http://www.allaboutdynamics.com
    Tuesday, March 23, 2010 6:27 AM
  • Hi Shahid,

     

    Thanks for immediate response. Well I've got a small doubts here. After migration, will the callout automatically turns to plugin....?. If so can you provide me the details of how to deploy my callout on disk for debugging.

    Tuesday, March 23, 2010 6:33 AM
  • Hi Shahid,

     

    Thanks for immediate response. Well I've got a small doubts here. After migration, will the callout automatically turns to plugin....?. If so can you provide me the details of how to deploy my callout on disk for debugging.

    Tuesday, March 23, 2010 6:33 AM
  • Please read following 

    http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/6915f388-5add-4c9f-81c4-c90b980adba4

     


    http://www.allaboutdynamics.com
    Tuesday, March 23, 2010 6:41 AM
  • http://msdn.microsoft.com/en-us/library/cc151075.aspx
    http://www.allaboutdynamics.com
    Tuesday, March 23, 2010 6:45 AM
  • I've gone through the given resource. I've understood the comments there. But we're not in a position to rewrite the callouts to plugins, our initial aim is to run the plugins....so I would need to debug the existing callout and if possible modify the code and place the newly built dll file in the assembly folder. Do you have any procedure to doing the same.

     

    I appreciate your help. Thanks in advance.

    Tuesday, March 23, 2010 7:01 AM
  • To debug the callout, you need to put it on the Assembly folder with its associated pdb file. Then you need to attache the the w3wp process that correspons to the CRMAppPool.

    To modify the code, you will need the source code of the callout of course.

    Just another question: What do you call 'Entity Xml' in your first message?


    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    Tuesday, March 23, 2010 7:12 AM
    Moderator
  • Thanks. I did the same thing. kept the dll file and its pdb file in the bin/assembly folder. I'm trying to attach w3wp process in the visual studio which was saying 'cannot attach'. Also I've the source code with me.....

     

    the 'Entity xml' was actually one of the parameter that will be received by callout during the create or update events of the opportunity.(see below).

    //PreUpdate method for the Opportunity entity.
    public override  Microsoft.Crm.Callout.PreCalloutReturnValue PreUpdate(
                Microsoft.Crm.Callout.CalloutUserContext userContext,
                Microsoft.Crm.Callout.CalloutEntityContext entityContext,
                ref string entityXml ,
                ref string errorMessage)

    I hope my code was getting failed when the code tries to read the data from entityxml which resulted to my debugging plan.

     

    Tuesday, March 23, 2010 8:26 AM
  • Ok, can you also post the callout.config.xml part that deals with this callout?
    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    Tuesday, March 23, 2010 8:31 AM
    Moderator
  • Below is my callout.config.xml file...

    <?xml version="1.0" encoding="utf-8" ?>
    <callout.config version="2.0">
        <callout entity="opportunity" event="PreCreate">
            <subscription assembly="CreditNotificationCallout.dll" class="CreditNotificationCallout.OpportunityCalloutClass">
            </subscription>
        </callout>
        <callout entity="opportunity" event="PreUpdate">
            <subscription assembly="CreditNotificationCallout.dll" class="CreditNotificationCallout.OpportunityCalloutClass">
            </subscription>
        </callout>
    </callout.config>

    Tuesday, March 23, 2010 8:50 AM
  • further I found 2 error messages in the event receiver during the execution of this callout (listed below). This code runs with out any problems in crm 3.0 ...now its saying 'object reference not found'. I cou'dn't figure out what the problem is....Can ANY ONE HELP ME .....

    Source: MSCRM CALLOUT

    Error: ISV code in organization: bca45886-820d-4209-b39a-2f68d4549b83; threw exception: assembly: CreditNotificationCallout.dll; class: CreditNotificationCallout.OpportunityCalloutClass; entity: opportunity, event: preupdate, exception: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at CreditNotificationCallout.OpportunityCalloutClass.PreUpdate(CalloutUserContext userContext, CalloutEntityContext entityContext, String& entityXml, String& errorMessage) in d:\crm 3.0\crm-testrun\creditnotification project\testinxcrmcreditnotificationcallout\opportunitycallout.cs:line 238
       at Microsoft.Crm.Extensibility.V3CalloutProxyPlugin.PreUpdateAdapter.InternalExecute(IPluginExecutionContext context, String& errorMessage)
       at Microsoft.Crm.Extensibility.V3CalloutProxyPlugin.PreCalloutAdapterBase.Execute(IPluginExecutionContext context)
       at Microsoft.Crm.Extensibility.V3CalloutProxyPlugin.CalloutAdapterBase.ExecuteAdapter(IPluginExecutionContext context)

    Source: MSCRMWebService

    Web Service Plug-in failed in OrganizationId: bca45886-820d-4209-b39a-2f68d4549b83; SdkMessageProcessingStepId: a7b87aa1-5c36-df11-b2f4-002421b46c78; EntityName: opportunity; Stage: 10; MessageName: Update; AssemblyName: Microsoft.Crm.Extensibility.V3CalloutProxyPlugin, Microsoft.Crm.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.V3CalloutProxyPlugin; Exception: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at CreditNotificationCallout.OpportunityCalloutClass.PreUpdate(CalloutUserContext userContext, CalloutEntityContext entityContext, String& entityXml, String& errorMessage) in d:\crm 3.0\crm-testrun\creditnotification project\testinxcrmcreditnotificationcallout\opportunitycallout.cs:line 238

     

     

    Tuesday, March 23, 2010 9:40 AM
  • Well it seems that your callout code expects some data that is not present (the entityXml?)

    You should trace the content of entityXml parameter to see what is passed to your callout


    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    Tuesday, March 23, 2010 10:13 AM
    Moderator
  • yep...you are correct. I'm looking into it. Once done.I'll post here.............
    Tuesday, March 23, 2010 10:25 AM
  • Hi Guys,

    I'm able to resolve the issue ....

    the actual problem is in reading the XML content

    in the callout i wrote the following code to read the data.....

    XmlDocument xdoc = new XmlDocument();                            
    xdoc.LoadXml(entityXml.ToString());              
    //Parse the XML                   
    XmlNode PropertiesList = xdoc.FirstChild; //which gives the first node in the xmldoc.

    this worked very well in the crm 3.0 but giving the 'object referene not found' error in 4.0. I replaced the statement with this.

    XmlNode PropertiesList = xdoc.ChildNodes.Item(1);

    Now it started working..

    INTERESTING...

    I've seen the xml content....and it is like this....

     

    <?xml version....>

    <properties xmlns=....>

    ..

    ..

    </properties>

    xdoc.FirstChild will probably giving the <xml version..> node and thus leading to the problem.....

    IF so...why it worked in CRM 3.0..? Any Ideas...

    • Marked as answer by Bittu.CRM Thursday, March 25, 2010 8:43 AM
    Tuesday, March 23, 2010 10:45 AM
  • The xml was not encoded in the same way it seems...

    So you just need to update your code! it is a good news!


    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    Tuesday, March 23, 2010 10:51 AM
    Moderator
  • Yah...you might be right...Well the real good news is my callout is working with the change of code. But unfortunately still I couldn't debug my callout. Any ideas why I couldn't do the debug. generally 'the calllout host' will be available when we trying to attach the process in visual studio. but i couldn't find the callouthost file when I'm attaching to w3wp (i've 2 instances of w3wp...i test with both). Any ideas why it is not available. by the way i'm using vs 2003 to attach to the process.
    Tuesday, March 23, 2010 12:15 PM
  • VS2003 works with the framework .Net 1.1 and your callout is executed under the framework 2.0 (Indeed, the web site).

    Compile your callout with Framework 2.0 (VS 2005 or 2008), then install remote debugger on the server.

    You should be able to debug your callout


    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    • Marked as answer by Bittu.CRM Thursday, March 25, 2010 8:43 AM
    Tuesday, March 23, 2010 12:19 PM
    Moderator