Call Custom Web Service from Plugin with impersonation

Call Custom Web Service from Plugin with impersonation

Post by QWxle » Mon, 17 Mar 2008 01:22:00


I have a web service that I placed in ISV folder of CRM Web Site.
When I try to call this web service from Plugin whith
CredentialCache.DefaultCredentials
I receive an error "No Microsoft Dynamics CRM user exists with the specified
domain name and user ID" . I think that Plugin runs under NT
AUTHORITY\NETWORK SERVICE user. In CRM 3 I was able
to call WS and use Impersonation by setting CallerId property of CRM Service.
How can I do this in CRM 4 ?
Thank You.
 
 
 

Call Custom Web Service from Plugin with impersonation

Post by QWppdGhnIF » Mon, 17 Mar 2008 16:22:01

You need to set it in the Crmservice.AutenticationToken i guess... Look at
the PluginHelper.cs in the http://www.yqcomputer.com/
which has a sample plugin.

Thanks
AjithG

 
 
 

Call Custom Web Service from Plugin with impersonation

Post by Jeff.Ruhno » Mon, 17 Mar 2008 22:38:45

I think you may want to investigate the CrmImpersonator class. This
allows you to take advantage of the credentials which the process is
executing under, which, if I understand your problem correctly, would
be the CRM user. If you pop open the SDK help file, and search for
CrmImpersonator, they give a good example. All you should need to do
is wrap your code in a using(CrmImpersonator()) { }

Jeff Ruhnow
www.questvar.com

On Mar 16, 2:22 am, Ajithg [MSFT]
 
 
 

Call Custom Web Service from Plugin with impersonation

Post by Jeff.Ruhno » Mon, 17 Mar 2008 22:45:34

On Mar 16, 2:22 am, Ajithg [MSFT]



I think the technique Ajith is talking about is setting the
CrmAuthenticationToken.CallerId Guid, which would also work, if you
passed the context.UserId from the plugin....perhaps this would be
simpler?

Jeff Ruhnow
www.questvar.com
 
 
 

Call Custom Web Service from Plugin with impersonation

Post by nathan_g_c » Wed, 30 Apr 2008 00:21:45

I am experiencing the same problems as Alex.

We are upgrading a v3 implementation to v4. I have a plugin that
invokes a custom webservice installed in the ISV folder. It seems that
CRM is not even stepping into the web service and just returns the
error: "No Microsoft Dynamics CRM user exists with the specified
domain name and user ID"

My custom web service can be invoked on a onload function on a CRM
form (it does not use the CrmImpersonator block) and this works fine
therefore the problem only arises from the plugin.

Using asp.net 3.0 with windows authentication.

Has anyone been able to resolve this?

Appreciate your time.

Nate

On 16 Mar, 14:45, " XXXX@XXXXX.COM " < XXXX@XXXXX.COM >
 
 
 

Call Custom Web Service from Plugin with impersonation

Post by Ajith [MSF » Thu, 15 May 2008 07:21:07

Hi

I have tried this and it worked in my tests. See if it works on your end.

When providing the Url for the Custom webservice, you might be doing some
thing like
http://localhost:5555/isv/myservice.asmx

Instead change that to include the Organization Name
http://localhost:5555/AdventureWorksCycle/isv/MyService.asmx

Note: Org Name is not the Fridnly name but the Unique name, so it should not
have any spaces. If your friendly name i same as unique name then you can
get it in Context.OrganizationName property else, you have to get it in
using configuration attribute on the SdkMessageProcessingStep.
--
Thanks
AjithG [MSFT]
http://www.yqcomputer.com/
http://www.yqcomputer.com/
This posting is provided "AS IS" with no warranties, and confers no rights.