Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Call Custom Web Service from Plugin with impersonation

22 views
Skip to first unread message

Alex

unread,
Mar 15, 2008, 12:22:00 PM3/15/08
to
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.

Ajithg [MSFT]

unread,
Mar 16, 2008, 3:22:01 AM3/16/08
to
You need to set it in the Crmservice.AutenticationToken i guess... Look at
the PluginHelper.cs in the http://code.msdn.microsoft.com/crmpluginsamples
which has a sample plugin.

Thanks
AjithG

Jeff....@gmail.com

unread,
Mar 16, 2008, 9:38:45 AM3/16/08
to
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]


<AjithgM...@discussions.microsoft.com> wrote:
> You need to set it in the Crmservice.AutenticationToken i guess... Look at

> the PluginHelper.cs in thehttp://code.msdn.microsoft.com/crmpluginsamples

Jeff....@gmail.com

unread,
Mar 16, 2008, 9:45:34 AM3/16/08
to
On Mar 16, 2:22 am, Ajithg [MSFT]
<AjithgM...@discussions.microsoft.com> wrote:
> You need to set it in the Crmservice.AutenticationToken i guess... Look at
> the PluginHelper.cs in thehttp://code.msdn.microsoft.com/crmpluginsamples

> which has a sample plugin.
>
> Thanks
> AjithG
>
> "Alex" wrote:
> > 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.

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

nathan...@yahoo.co.nz

unread,
Apr 28, 2008, 11:21:45 AM4/28/08
to
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, "Jeff.Ruh...@gmail.com" <Jeff.Ruh...@gmail.com>
wrote:


> On Mar 16, 2:22 am, Ajithg [MSFT]
>
>
>
> <AjithgM...@discussions.microsoft.com> wrote:
> > You need to set it in the Crmservice.AutenticationToken i guess... Look at
> > the PluginHelper.cs in thehttp://code.msdn.microsoft.com/crmpluginsamples
> > which has a sample plugin.
>
> > Thanks
> > AjithG
>
> > "Alex" wrote:

> > > I have a web service that I placed in ISV folder ofCRMWeb Site.


> > > When I try to call this web service from Plugin whith
> > > CredentialCache.DefaultCredentials
> > > I receive an error "NoMicrosoftDynamicsCRMuserexistswith thespecified

> > >domainnameanduserID" . I think that Plugin runs under NT
> > > AUTHORITY\NETWORK SERVICEuser. InCRM3 I was able


> > > to call WS and use Impersonation by setting CallerId property ofCRMService.

> > > How can I do this inCRM4 ?

Ajith [MSFT]

unread,
May 13, 2008, 6:21:07 PM5/13/08
to
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://code.msdn.microsoft.com/crmplugin
http://code.msdn.microsoft.com/crmpluginsamples
This posting is provided "AS IS" with no warranties, and confers no rights.

<nathan...@yahoo.co.nz> wrote in message
news:4e8ef0ba-d698-44cb...@e39g2000hsf.googlegroups.com...

0 new messages