0

I'm having troubles setting up a project that access to my company's clarity application. I've successfully configured a service reference (in my VisualStudio project) to the XOG I'm trying to connect to. My actual code is the following:

        Auth objAuth = new Auth();
        Login login = new Login();
        login.Username = "mylogin";
        login.Password = "mypwd";
        login.TenantId = "clarity";
        MyXOGQueryPortClient client = new MyXOGQueryPortClient();
        string ClaritySessionID = client.Login(login);
        objAuth.SessionID = ClaritySessionID;

Our clarity application have the Company's SSO configured so I've logged in to the SSO service through InternetExplorer and also inside the VisualStudio's Webbrowser. Indeed, if I connect to the clarity URL using a browser I'm NOT redirected to the SSO page. The problem is that when the program calls client.Login() it is returning a ProtocolException "The content type text/html of the response message does not match the content type of the binding (text/html; charset=utf-8)[...]". In the exception I can see the body of the page an it is the SSO redirection page.

The question is: Am I doing something wrong with the code? Can I bypass the SSO page considering that the SSO has already been done? I'm not strictly obliged to use C# (or even .NET) so, if there are solutions based on other languages, any help will be appreciated.

Thank you

Tobia Zambon
  • 7,479
  • 3
  • 37
  • 69
  • What do you mean by saying the "SSO has already been done"? Logging in via internet explorer or the visual studio web browser has nothing to do with programmatic C# web service code. – Nathan Sep 11 '15 at 05:27
  • Ok I don't know exactly how the SSO works, it's the very first time I deal with it. I've read your answer and I'll move forward with the second option you gave me – Tobia Zambon Sep 11 '15 at 06:27

2 Answers2

1

I'm not very familiar with Clarity/XOG, but as it appears to be more or less a standard web service, I offer the following possibilities.

  1. Register a user with Clarity that is not part of your SSO implementation, and use that as a kind of service account. It appears that Clarity on Demand offers the capability to mark a user as "external" or not. So registering a user marked as "not" external and using those credentials is probably your easiest way forward. From https://communities.ca.com/thread/241696306

Have you tried using a xog user with the External Authentication unchecked (on the admin side), and having all the necessary xog rights ?

  1. Barring that, your other option would be to communicate with your SSO login page via standard http protocol by constructing http requests (e.g using HttpClient) and posting appropriate form variables (I'm assuming your SSO doesn't offer a web service) to obtain the authentication cookie. Note the cookie must be valid for the web service site, so depending on exactly how things are setup, you will likely need to programmatically process a chain of http requests to get the correct cookie. Once you have obtained the authentication cookie, pass that cookie along in your web service call.

For more information on passing cookies with a WCF web service call, see Making web service calls with WCF client + cookies (which uses the OperationContext).

Or you can consider using a message inspector to apply the cookie(s) to the request.

See also:

Community
  • 1
  • 1
Nathan
  • 10,593
  • 10
  • 63
  • 87
  • Thank you Nathan, I don't know if my company allows me to use an external user. The second option is the one I was already moving on, I will let you know if it'll work. – Tobia Zambon Sep 11 '15 at 06:23
0

I would recommend using Clarity's own XOG client to check that you can login and read/write XOG files as needed beforehand. That is a published and well proven interface.

Once that is working look to utilise XOG from another environment. Bearing in mind that XOG is all XML based it is best to use something that is good at processing XML.

An alternative to using the Clarity XOG client is to use SoapUI (http://www.soapui.org), which allows you to be a little more interactive.

I would also recommend searching the CA Clarity forums on ca.com

Mark80
  • 55
  • 1
  • 7