Documentation Center

Using .SVC Web Service in C# for ISHSTS

This topic contains a small example for a SVC. web service call with claims based authentication from ISHSTS which is the out-of-the-box STS for internal Content Manager users

Before you begin

To follow the steps in this task, the following must be true:
  • You have Microsoft .NET Framework and Microsoft Visual Studio installed on your system.
  • You know the full URL of the Content Manager web services, which is of the format https://SERVER/ISHWS, where SERVER is the name of the Content Manager server, say, https://ish.example.com. In the steps below, the full URL is referred as "the web service URL."

About this task

This example describes how to make two WCF SVC. web service calls to get the version of the Content Manager components and the metadata for the logged in user when your system is configured to use the out-of-the-box ISHSTS. The example is based on username/password authentication but extra remarks are present to change to windows authentication.

Procedure

  1. Create a Visual Studio Project, for example, a Console Application
  2. Navigate to the project and right click References section.
  3. Add a web service reference to the Application25 web service:
    1. Select Add Service Reference
    2. Under Address, enter the web service URL followed by /Wcf/API25/application.svc

      For example: https://ish.example.com/ISHWS/Wcf/API25/application.svc

    3. Under Namespace, enter the value Application25ServiceReference
    The Visual Studio code generator creates the necessary classes for the proxy, as well as the application configuration file, app.config. In this file, the issue/wstrust/mixed/username has been automatically chosen. This endpoint is used for username/password driven authentication
  4. If you want Windows authentication, do the following:
    1. Open app.config for editing.
    2. Go to CustomBinding_Application binding (at the top) and locate the issuedTokenParameters node.
    3. Replace the full issuer node with the correct issuer. Typically, the other endpoints are available in commented form in the configuration as <alternativeIssuedTokenParameters>.
    4. Locate and copy the right issuer endpoint for binding ws2007HttpBinding.
      For this example, we use the issuer that has a binding configuration for issue/wstrust/mixed/windows.
    5. Repeat the steps b through d for CustomBinding_Application1
  5. Add a web service reference to the User25 web service:
    1. Select Add Service Reference
    2. Under Address, enter the web service URL followed by /Wcf/API25/user.svc

      For example: https://ish.example.com/ISHWS/Wcf/API25/user.svc

    3. Under Namespace, enter the value User25ServiceReference
  6. Open the app.config file.
  7. Check that there is exactly one endpoint for each web service reference.
    1. The Content Manager web services are available via http and https. Regardless of the choice you made in the WebServiceURL both endpoints are present in the app.config. Remove the endpoint that does not match your web service URL.
      <endpoint address="http://ish.example.com/ISHWS/Wcf/API25/Application.svc" 
        binding="customBinding" 
        bindingConfiguration="CustomBinding_Application"   
        contract="Application25ServiceReference.Application" 
        name="CustomBinding_Application" />
      <endpoint address="https://ish.example.com/ISHWS/Wcf/API25/Application.svc" 
        binding="customBinding" 
        bindingConfiguration="CustomBinding_Application1" 
        contract="Application25ServiceReference.Application" 
        name="CustomBinding_Application1" />
    2. Check that there is an endpoint for both web services.

      The endpoint for a second web service reference is not always added automatically. If the endpoint is missing, copy the chosen endpoint of the other web service and correct the address and the contract parameters to match the missing endpoint.

      You have now added two endpoints:

      • One endpoint with its address attribute set to WEBSERVICEURL/Wcf/API25/Application.svc and with its contract attribute set to Application25ServiceReference.Application
      • One endpoint with its address attribute set to WEBSERVICEURL/Wcf/API25/User.svc and with its contract attribute set to User25ServiceReference.User

      where WEBSERVICEURL is the web service URL.