1

I have a simple WCF client over HTTPS that works pretty fine with the WCF Test Client. Now when I enabled Federation to WCF, the same works fine in a browser.

  1. As soon as I access the svc URL, it redirects to the federated login page.
  2. After valid authentication, it comes back with the metadata page.

I would like to perform the same with WCF Test Client. But in Fiddler, it redirects with an Error 302 and hence fails to get any metadata. The same is observed when I created a console application and consume the call.

Note: I do not want to create a Web application to test the same.

Questions:

  1. Is this scenario possible?
  2. If yes, what needs to be done if I need to make it work via client applications.
Jongware
  • 22,200
  • 8
  • 54
  • 100
Suhas TJ
  • 65
  • 1
  • 8

1 Answers1

0

If you are using WSFederationBinding, the WCF Test Client does not support it, as noted here:

https://msdn.microsoft.com/en-us/library/bb552364%28v=vs.110%29.aspx

You can, however, build a custom test client. For example, you can build a Windows Forms client or a Console app that makes a service reference to the federated services and issues a client credential token in code. Microsoft has an article on programmatically creating a client credential token here:

https://msdn.microsoft.com/en-us/library/ms731690%28v=vs.110%29.aspx

maniak1982
  • 707
  • 2
  • 7
  • 23
  • Thanks, But is there any way to test it via console application at least? because, i have 200+ api's and i already have test client to test the same. – Suhas TJ May 12 '15 at 10:48
  • I've never done this before, but Microsoft has a page on generating an IssueTokenClientCredential in code, which should be a good start: https://msdn.microsoft.com/en-us/library/ms731690%28v=vs.110%29.aspx I don't know if you have ever called a WCF service from a console app, but to access the service you can add a service reference as you usually would unless there are any special settings you need to pass to svcutil. – maniak1982 May 12 '15 at 13:10
  • That is the one i am looking for. Thanks. Actually, we use a console application to test the WCF before it is being goes to production. Since there are 200+ APIs, creating a test UI with federation is extra overhead. – Suhas TJ May 13 '15 at 04:31
  • Can you please post your comment as main answer? That would help other. – Suhas TJ May 13 '15 at 04:45