views:

55

answers:

2

In the white paper, it said that we can use REST to ask for the token then use the token to attache to the request we are going to fire, then can invoke the service in the service bus, how ever, i cannot get the token

Bellow are the codes i use to make REST call, i can get the result, but which was a html error page.. i didn`t get any token...and i am sure my solution name and password are correct. coz my service in the cloud are RESTful service, when i put the service endpoint onto the broswer, it ask me to input my solution name and password, i input the same as in use in the code below, and it work just fine...

can anyone tell me why the code below i cannot get what the white said??

public static String call() {
    try {
        HttpClient client = new HttpClient();
        String uri = String.format("https://accesscontrol.windows.net/isssuetoken.aspx?u=%s&p=%s", "solutionname", "password");
        log.debug("Out going uri is : " + uri);
        GetMethod get = new GetMethod(uri);
        int status = client.executeMethod(get);
        byte[] responseBody = get.getResponseBody();
        log.debug("status return is : " + status);
        if (status == HttpStatus.SC_OK) {
            return new String(responseBody);
        }
    } catch (Exception ex) {
        log.error("Error while calling AccessControl protal.", ex);
    }        
    return null;
}

================ Below are the words from white paper =============

https://accesscontrol.windows.net/isssuetoken.aspx?u={solution-name}&p={password}

The response contains a reference cookie (in plain text format) to a token held within the .NET Access Control Service. The client can use the cookie to gain access to the relay service by adding the cookie value to outgoing HTTP requests in a custom HTTP header named “X-MS-Identity-Token”. When using this technique, Microsoft strongly recommends using HTTPS to protect the cookie value on the wire. For more information on the .NET Access Control Service, and to learn specifically about how you can use it in conjunction with your own services (not just through the .NET Service Bus), see the accompanying whitepaper called A Developer’s Guide to the .NET Access Control Service.

A: 
    String uri = String.format("https://accesscontrol.windows.net/isssuetoken.aspx?u=%s&p=%s", "solutionname", "password");

the like above is wrong... the white paper get a misstake,

there is one extra 's' in the link, it should be String uri = String.format("https://accesscontrol.windows.net/issuetoken.aspx?u=%s&p=%s", "solutionname", "password");

shrimpy
A: 

FYI, this is not REST at all. It is simply RPC.

Wahnfrieden