Share via


Using the CRM SDK offline

I've been meaning to write something about using the CRM SDK in an offline state, and I've been meaning to write it for a few years now. I guess I never had the right prodding, but recent newsgroup posts show that there are people interested in this, and that they're stuck.

 

So, I started doing a little playing around to see what might happen. First thing I noticed is that, as expected, if the client isn't in an offline state you can't work with the local web server. There's code deep in the platform security layer that flat out stops the calls. Ok, that's easy enough to do - let's put the client in an offline state for a while and see what breaks next.

 

I needed an "application" to test with and I just happened to have my RSS feed generator bits handy and hot off the press. They're really simple and use a very narrow set of CRM SWS (what we call the web service) methods. In fact, it only uses Fetch() to do all of its magic (oh yeah, and it uses a ton of metadata, but that's another posting). Well, as many of you have noticed, you can't get reasonable WSDL from the offline SWS because the module that generates our WSDL (which happens dynamically if you're wondering) isn't on the client. There's just no need for it there.

 

I pulled WSDL from the server endpoint and hand-tweaked it so it had just the API set that I needed. This isn't strictly necessary, but given the size of the generated code and number of classes there's a significant hit to start-up performance as the CLR reflects over all those types. Anyway, all I needed was Fetch() so I removed everything else and compiled up the resulting CS file into a client proxy assembly.

 

After installing everything I thought I'd need to run my application offline I noticed that there was a problem hitting the SWS in Cassini, particularly around executing queries. In this case the thing to remember is that queries are old V1.x functionality and that they're implemented in native C++. That means the SWS needs its own proxy to get at those C++ bits. That's where the COM proxy comes in (warning: the COM proxy has already been removed from the next release's build environment, so don't assume you can use this in any supported way for anything).

 

You might have noticed that the COM proxy isn't on the client machine anywhere (although there is another client-specific COM proxy, but that's not the one we want for this exercise). Go to your install CD or grovel the COM proxy from somewhere off your server and copy it to the res/web/bin directory on the client. Then, and this is important, GAC it so it's accessible from the Cassini process.

 

That's all I needed to do to get arbitrary query support on the client in a custom application offline. I haven't expanded to arbitrary reads through other messages, but I'm assuming that they should all work. I also haven't done anything with create / update / delete yet because those requests must end up in the playback queue. The COM proxy doesn't do this work. If I remember correctly, this happens somewhere in the RC proxy or in Cassini itself (it would make the most sense for this to work as an HTTP handler inside of Cassini since we want to capture SOAP requests for later playback).

 

Anyway, I hope that unblocks a few creative people and gets them moving in a direction that helps. I'd love to start seeing some add-on code running in an offline state. Granted, things like callouts and workflow won't work offline, so don't even both trying to make them work.

 

If anyone comes up with a cool offline add-on I'd like to hear about it.

Comments

  • Anonymous
    March 02, 2006
    Inspect your blog on 1600x1200 screen and you'll find out why it's difficult to read it.
  • Anonymous
    March 02, 2006
    Hmm... I write it on a 1600x1200 display. Anyone else having a problem?
  • Anonymous
    March 02, 2006
    Nope. That's why I don't use that resolution. You could use a cleaner font though. Nice blog today! I'd like to hear back from a user who tried the same thang.
  • Anonymous
    March 02, 2006
    I'm reading on a 1920x1200 display, no problem here.

    Interesting post BTW :)
  • Anonymous
    March 02, 2006
    I'm also wondering to hear about succsessfull inmplementations of the client side sdk. Good Luck
  • Anonymous
    March 03, 2006
    Ok, you may use a different font, it's hard to read.

    Coming back to the initial post, I think that I found a solution to modify data in offline mode. It's not using the web services, as they do not work, and it's not using direct SQL updates, as this may cause side effects. The basic idea is to do the same as Internet Explorer does.

    So I started to monitor the HTTP traffic being sent in online and offline mode, noticed what's going on and finally got my first account created while offline. And it even was replicated to the server when back online.

    I documented all of that at http://www.stunnware.com/crm/doc/Changing%20data%20in%20offline%20mode/default.htm, so if you're interested, have a look at it.
  • Anonymous
    March 04, 2006
    PingBack from http://blogs.infinite-x.net/?p=37
  • Anonymous
    March 04, 2006
    PingBack from http://blogs.infinite-x.net/?p=64
  • Anonymous
    March 06, 2006
    Mike,

    I wrote a customization for a client that used the 1.2 OutlookProxy.

    With this customization, I was able to read/update/delete data, view the data in the Offlinequeue table and then confirm the syncronization on the server when the client went back online.

    Reading your post, are you saying that I could use the 1.2 OutlookProxy to access the data on Crm 3.0 Outlook client?

    Thanks in advance
    kcm
  • Anonymous
    March 06, 2006
    Parts of the 1.2 RC proxy might work, but I wouldn't bet on it at all. Quite a bit changed between 1.2 and 3.0 that you'd probably want to try you experiment using the 3.0 bits directly.

    I've considered writing a post about accessing the offline client bits using the RC proxy, but that's even deeper than I'd be willing to send a customer. My goal for this post was to make sure that the web services are there and functional even though they're not answering the phone on a WSDL request.
  • Anonymous
    March 15, 2006
    I have been travelling and presenting quite a bit, and I have not been able to post as often as...
  • Anonymous
    March 24, 2006
    We've finally released the RSS connector for MS-CRM. This has been a long release mired in a few documentation,...