I have just installed the SDL Web8 Content-Service and Discovery-Service on Windows Server as standalone micro services, and now I am trying to validate that the services are functioning correctly.

To do so, I thought I would try to access the services at the respective URLs

Token-Service URL: http://localhost:8082/token.svc RESPONSE: SDL Web OAuth 2.0 Token Servlet.

Discovery-Service URL: http://localhost:8082/discovery.svc RESPONSE: {"error":"invalid_grant"}

Content-Service URL: http://localhost:8081/content.svc RESPONSE: HTTP Server ERROR - Parser Error Message: The ending bracket '>' for the 'ServiceHost' directive is missing in the '.svc' file.

From this test it seems like my Content-Service is not working, but the Token-Service and Discovery-Service are OK.

1) Is this a correct assumption? Are these expected results?
2) Is there a better way to validate that these individual micro services are correctly installed? Without having a full end-to-end implementation?

3 Answers 3


I would use the token service to test the other two, thus ensuring that all 3 of them are working.

To do so, though, you need to be able to create a specific HTTP request, setting the method and headers, etc. There are lots of tools out there; I typically use the Postman Chrome extension.

Test the token service by getting a token you can use with the other services. That requires a POST request with the following headers:

client_id=(the client ID of a user in the 'cd' role - e.g. 'cduser')
client_secret=(the secret for the above user)

This should return some JSON that looks similar to this:

  "access_token": "client_id%3Dcduser%26Role%3Dcd%26FirstName%3DCD%26AllowedCookieForwarding%3Dtrue%26LastName%3DUser%26expiresOn%3D1453468661956%26digest%3DH9ZqEIrObxTLFVjqAnKDcdQrVgzKe1UJohYgovBbQz4%3D",
  "refresh_token": "d101quao1cap8r90q6f41tyhtijyks7ww15u1gd53b756jsly",
  "token_type": "Bearer",
  "expires_in": 300

Copy the value of 'access_token'. You can then use this token to access the other services using a GET request with an 'Authorization' header set to "Bearer " (note the space) and the token you copied:

Authorization=Bearer client_id%3Dcduser%26Role%3Dcd%26FirstName%3DCD%26AllowedCookieForwarding%3Dtrue%26LastName%3DUser%26expiresOn%3D1453468661956%26digest%3DH9ZqEIrObxTLFVjqAnKDcdQrVgzKe1UJohYgovBbQz4%3D
  • I can't make it work with the "content.svc" using the aurhorization header. But it works with the "discovery.svc". It has to work the same way? with the token generated with the same "token.svc"? Commented Feb 5, 2016 at 2:26
  • Yes, the token works for both. I'm pretty sure your Content service isn't working correctly, though. As Rick mentioned, the response is unexpected and possibly coming from a completely different service. Commented Feb 8, 2016 at 9:16
  • The SDL documentation shows a nice HTML form which hows how to retrieve the token from the token service: docs.sdl.com/LiveContent/content/en-US/SDL%20Web-v1/…
    – Jan H
    Commented May 13, 2016 at 6:49
  • I'm not sure if there is a way to do this with headers, but I used the following format in my request body: grant_type=client_credentials&client_id=XXXXXX&client_secret=XXXXXXX&resources=/ Commented Aug 31, 2017 at 0:22

Your assumption that the first two responses are OK, but the third is not is correct.

When OAuth is enabled (the default), all CD microservices (except the token service) expect an OAuth bearer token in the HTTP Authorization header (as described by Peter) and will return an invalid grant error if such a bearer token is not provided. If you get such a response, that is a good sign that the microservice is up and running.

The response of the Content Service is different; I have not seen such a response before. Looks like the request is not actually handled by the CD Content Service, but by something else. Maybe there's a port conflict?


To test the Discovery service you need to get a token from the Token Service and then use the access_token to call the Discovery service (or other services you want to test).

Here is how I did this with PowerShell. (you will need to add error handers)

I used this method so that I can automate the service installation and testing.

But Now I use Dominic's Invoke-RestMethod

Test Live Site

#Live site
$TtmServiceUrl = "https://YourLiveSite.tridion.sdlproducts.com:8082"
$client_secret = "LiveSiteSecretKeyCode"
$access_token = Get-TtmCdAccessToken -TtmServiceUrl $TtmServiceUrl -client_secret $client_secret
Get-TtmcdDiscovery -TtmServiceUrl $TtmServiceUrl -access_token $access_token

Test Stage Site

#Stage site
$TtmServiceUrl = "https://YourStageSite.tridion.sdlproducts.com:8083"
$client_secret = "StageSiteSecretKeyCode"
$access_token = Get-TtmCdAccessToken -TtmServiceUrl $TtmServiceUrl -client_secret $client_secret
Get-TtmcdDiscovery -TtmServiceUrl $TtmServiceUrl -access_token $access_token

Get Access token

function Get-TtmCdAccessToken()
  [Parameter(Mandatory=$True,HelpMessage="Please enter the Ttm service url")]
  [Parameter(Mandatory=$True,HelpMessage="Please enter the client secret")]
  [string]$client_id = 'cduser',
  [string]$grant_type = 'client_credentials'

    $h = [ordered]@{
        client_id     = $client_id
        client_secret = $client_secret
        grant_type    = $grant_type
        resources     = "%2F"

    $postdata = [system.String]::Join("&", $( $h.Keys | % { "$_=$($h.Item($_))" }) )

    $webClient = New-Object System.Net.WebClient

    $result = $webClient.UploadString("$TtmServiceUrl/token.svc",$postdata) | ConvertFrom-Json

    return $result.access_token

Get Discovery Service

function Get-TtmcdDiscovery()
  [Parameter(Mandatory=$True,HelpMessage="Please enter the Ttm service url")]
  [Parameter(Mandatory=$True,HelpMessage="Please enter the access token")]

    $Authorization = "Bearer $access_token"

    $webClient = New-Object System.Net.WebClient

    $xmlresult = $webClient.DownloadString("$TtmServiceUrl/discovery.svc")
    return $xmlresult
  • Hi Chris, I've taken a very similar approach, but if you use Invoke-RestMethod, you can get your script to be shorter/more focussed. I blogged some sample code after my TDS talk. blog.indivirtual.nl/testing-sdl-web-8-micro-services Commented Jun 20, 2016 at 12:55
  • Hi Dominic, Yes, our approaches are almost identical, but your solution with Invoke-RestMethod is superior. Thanks for posting on your blog. Commented Jun 21, 2016 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.