Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Fixing WS-Trust while using early bound classes

(0) ShareShare
ReportReport
Posted on by 4

Hello there!

 

  1. I refactored code to connect to Dynamics by using the Oauth CRMServiceClient(<connectionstring>) method as explained here:
    https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-office365-deprecation
  2. I also use early-bound classes generated by CrmSvcUtil/XrmToolbox as explained here: 
    https://docs.microsoft.com/en-us/power-apps/developer/data-platform/org-service/generate-early-bound-classes
  3. However, when you use generated early-bound classes, you have to enable proxy types as explained here (see the green tip):
    https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg328210(v=crm.8)?redirectedfrom=MSDN
    Which means, the generated early bound class file has this attribute at the top:
    [assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
    And in the connection code, I enabled proxy types (explained later). The problem is, EnableProxyTypes is a method that exists only in the OrganizationServiceProxy class--which is a class that is now forbidden by link #1 above.

Therefore, I must obtain a connected client using this:

 

var CrmSvc = new CrmServiceClient(<OauthConnectionString>);

 

However, I get this error:

 

A proxy type with the name <entity name> has been defined by another assembly

 

I could try adding the below lines that EnableProxyTypes, but they are forbidden by the documentation (link #1 above says not to use OrganizationServiceProxy):

 

CrmSvc.OrganizationServiceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior(Assembly.GetExecutingAssembly()));
CrmSvc.OrganizationServiceProxy.EnableProxyTypes(Assembly.GetExecutingAssembly());

 

So my question is, what is the correct way to enable proxy types (or in general, use early-bound generated classes), while complying with the removal of WS-Trust?

 

Thank you!

 

  • somo Profile Picture
    4 on at
    Re: Fixing WS-Trust while using early bound classes

    @eriksteinebach1 unfortunately no. The error I get concerning this is intermittent. so even when I contacted Microsoft support about it, they weren't able to properly debug/reproduce the issue. Maybe you could have better luck contacting them?

  • eriksteinebach1 Profile Picture
    2 on at
    Re: Fixing WS-Trust while using early bound classes

    Were any of you ever able to figure this out? I am running into the same issue right now. Trying to enable ProxyTypes with the OAuth enabled Microsoft.PowerPlatform.Dataverse.Client.ServiceClient, but I am not able to find a way to do this.

  • pavanmanideep Profile Picture
    483 on at
    Re: Fixing WS-Trust while using early bound classes

    Hi @somo ,

     

    Thanks, I am afraid as I am couldn't find a way too...could you pls raise to support ticket to Microsoft to see what they say....

     

    Thank you.

     

    Cheers,

    PMDY

  • somo Profile Picture
    4 on at
    Re: Fixing WS-Trust while using early bound classes

    Hello @Pavan_Mani_Deep Thank you for your response! I've edited my post to hopefully make it more clear that I've already taken the steps suggested in your blog post. In short: The new Oauth connection requirements are incompatible with early-bound generated classes, because Oauth does not have an allowed way to enable proxy types. At least, that's what it seems. Would love a definitive answer from Microsoft on this.

  • pavanmanideep Profile Picture
    483 on at
    Re: Fixing WS-Trust while using early bound classes

    Hi @somo, May I know what were you building, you could prefer organization service instead, do remember that you need to refractor your code a bit, I have written a blog post way back in 2020...please go through it here once https://ecellorscrm.wordpress.com/2020/06/09/are-you-still-using-ws-trust-auth-and-organizationserviceproxy-then-it-is-time-to-change/, do let me know if you have any further questions....

     

    Cheers,

    PMDY

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 76 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

Overall leaderboard