Creating A Service Bus SAS Token and Consuming Relay in WinRT

I have a Service Bus Relay (WCF SOAP) I want to consume in my Windows Store App. I have written the code to create a token as well as the client which is below.
The problem is that I get an AuthorizationFailedFault returned with a faultstring "InvalidSignature: The token has an invalid signature." And I can't figure it out.
My Create Token method:
private static string CreateSasToken()
TimeSpan sinceEpoch = DateTime.UtcNow - new DateTime(1970,1, 1);
var expiry = Convert.ToString((int)sinceEpoch.TotalSeconds + 3600);
string stringToSign = webUtility.UrlEncode(ServiceUri.AbsoluteUri) + "\n" + expiry;
string hashKey = Encoding.UTF8.GetBytes(Secret).ToString();
MacAlgorithmProvider macAlgorithmProvider = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha256);
BinaryStringEncoding encoding = BinaryStringEncoding.Utf8;
var messageBuffer = CryptographicBuffer.ConvertStringToBinary(stringToSign,encoding);
IBuffer keyBuffer = CryptographicBuffer.ConvertStringToBinary(hashKey,encoding);
CryptographicKey hmacKey = macAlgorithmProvider.CreateKey(keyBuffer);
IBuffer signedMessage = CryptographicEngine.Sign(hmacKey, messageBuffer);
string signature = CryptographicBuffer.EncodeToBase64String(signedMessage);
var sasToken = String.Format(CultureInfo.InvariantCulture,
"SharedAccessSignature sr={0}&sig={1}&se={2}&skn={3}",
WebUtility.UrlEncode(ServiceUri.AbsoluteUri),
WebUtility.UrlEncode(signature), expiry, Issuer);
return sasToken;
My Client class:
public partial class ServiceClient
public async Task<string> GetDataUsingDataContract(string item, string sasToken)
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("ServiceBusAuthorization",sasToken);
client.DefaultRequestHeaders.Add("SOAPAction",".../GetDataUsingDataContract");
client.DefaultRequestHeaders.Add("Host", "xxxxxxxxxxx.servicebus.windows.net");
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post,ServiceUri);
var content =new StringContent(@"<s:Envelope
xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">
<s:Header></s:Header><s:Body>"+ item +@"</s:Body>
</s:Envelope>",System.Text.Encoding.UTF8,"application/xml");
request.Content = content;
HttpResponseMessage wcfResponse = client.SendAsync(request).Result;
HttpContent stream = wcfResponse.Content;
var response = stream.ReadAsStringAsync();
var returnPacket = response.Result;
return returnPacket;
I have been successful consuming the Relay using Http (via Fiddler) by copying an unexpired token created by Micorosft.ServiceBus in a console app.
John Donnelly

Thanks Girish. I eagerly await some help on this. I have figured a lot out but I am stuck on creating a good SAS Token.
I reposted a question I asked on StackOverflow here  in this MSDN forum
here if you can help on creating steer me in the right direction.
John Donnelly

Similar Messages

  • Cannot create Azure Service Bus connector

    Hi,
    I tried to create a service bus connector. I did put in the connection string and the name of the queue, validation passed showing a green check. For the rest of the settings I just used default values given. The Create button is still disabled and
    it doesn't give any info as what's missing.
    Thanks,
    Paul

    Hi Paul - could you send us a screenshot of this? We'll take a look
    Thanks,
    Prashant

  • When creating self service request contains attachments and it's approved

    when creating self service request contains attachments and it's approved  is the attachments automatic transfer to the applet form or not?

    resolved

  • How to create Generic Service in HCM Processes and Forms

    Hi Friend's,
      Can you tell me what are the steps to create Generic Service in HCM Processes and Forms and also tell me how to link Generic service with BADI.
       In SPRO, I defined one customized generic service, but i cant able to implement the generic service to BADI. Moreover it's asking for Composite Badi Implementation name.
       So tell me the steps which guide me to create that.. Waiting for your replies....

    hi ramesh,
                      use HRASR00GEN_SERVICE_BASIC  create ur own.
    Madhukar

  • Create Oracle Service Bus using BEA workshop

    Can someone please help with BEA Workshop developer guide/tutorial detailing how to create Oracle Service Bus using workshop IDE.
    IDE - BEA Workshop 10gR3
    OSB version - Oracle Service Bus 10gR3
    Thank you

    Thanks for your response Eric.
    The tutorials that I've seen so far deal with OSB console, none of them talk about creating OSB using BEA-workshop.
    On workshop IDE there is some help on OSB workshop plug-ins, but those are mostly one liners about the plug-in features
    Please advice if you've link to OSB-Workshop tutorial.
    Thanks

  • How to create a service to UPLOAD / DOWNLOAD and send emails with files?

    Good afternoon!
    I need to create a service that sends files via email or FTP, and a service to upload / download files on a server.
    I see on the internet does not have much aid to make it in the ADF.
    Could someone send me some links, documentation, so I can get the job done?
    Thank you,
    Lewis.

    "I see on the internet does not have much aid to make it in the ADF."  - You are kidding - do you?!
    1) Google: ADF Faces file upload
    2) Google: ADF Faces image download
    3) Google: ADF send mail
    I get all the relevant hits (documentation and blog entries) by using these 3 queries in Google.
    If you mean "Web Service" by "Service" then better - just Google for Web Service and image handling to find information on this. You don't use ADF to build Web Services, which is why you need to express your search criteria different
    Frank

  • Oracle Service Bus (OSB), Eclipse --- and statement of direction

    Can somebody please explain what this means in: http://www.oracle.com/technology/products/integration/service-bus/docs/Oracle-Service-Bus-SOD.pdf
    +...The web-based console was complemented in the 3.0 release with full IDE support in Eclipse. The Eclipse capabilities will be ported to Oracle JDeveloper to provide a one-stop IDE for all SOA design needs. Until that port is complete, customers will still be able to use the Eclipse environment as IDE (in addition to the web-based console)...+
    More specifically: what will happen to the Eclipse OSB plugin/workshop once the JDeveloper port is complete?
    A) will it cease to exist and/or be terminated?
    B) will it remain as is, without keeping the functionality in synch with new stuff in JDev?
    C) will it continue to evolve side-by-side with JDev?
    Thx,
    -J.

    I think it is clear that Oracle will remain commited to Eclipse in terms of deploying java applications to WebLogic, they will provide some plugins for some time to come. You will however see oracle specific products, such as OSB, Portal, etc removed from Eclipse and ported to JDev. The reason for this is that Oracle can release new releases within their timeframe. If Oracle rely on Eclipse to deliver some functionality before they can release new products then they will be doing their customers a disservice.
    This statement in the SOD clearly states that JDev is the strategic platform and the Eclipse IP will be ported to JDev in the future:
    Design-Time Environment
    JDeveloper is the IDE of choice for SOA development at Oracle. AquaLogic Service Bus users have traditionally been using the web-based console to design, manage and monitor ESB flows. The web console is a key differentiator for ALSB (now Oracle Service Bus) and will therefore remain a primary design
    environment moving forward.
    The web-based console was complemented in the 3.0 release with full IDE support in Eclipse. The Eclipse capabilities will be ported to Oracle JDeveloper to provide a
    one-stop IDE for all SOA design needs. Until that port is complete, customers will still be able to use the Eclipse environment as IDE (in addition to the web-based
    console).
    cheers
    James

  • Oracle Service Bus IDE plugin and OEPE

    Hello,
    Due to some trouble I got with Oracle Workshop 10gR3 with JEE5 development, I switch to Oracle Enterprise Pack for Eclipse (OEPE) 11g.
    As I have to use oracle Service Bus 10gR3, I would like to benefit from the Oracle Service Bus plugin bundled with Oracle Workshop.
    I would to avoid switch between two Eclipse's instances (Europa and Ganymede).
    Is it possible to deploy Oracle Service Bus Eclipse's plugin on OEPE 11g?
    Thanks

    May I did not well expressed my question.
    I did not tried to deploy Oracle Service Bud IDE plugins on OEPE 11g.
    I can figure out that this will not work properly.
    If I understand, the plan for the future is to adopt OEPE 11g even for Oracle Service Bud IDE.
    Is there any date for this?
    Thanks

  • Oracle service bus: Work manager and Throttling

    Hi
    Flow is PS_C--->BS_A (based on PS_A)
    I created a http protocol based proxy service PS_A and a business service based on PS_A, i.e. BS_A.
    Now this BS_A is deployed on four different managed servers. I have implemented failover so at a time copy of only one of the managed severs will be accessed by multiple external clients through PS_C. To say all will hit Managed server-1 copy of BS_A. If Managed server-1 is down then it will hit Managed server-2 copies of BS_A.
    I have created a workmanager named "CustomWorkManager" which has MaxThreadConstraint=1. PS_A has not enabled CustomWorkManager. i.e. PS_A works under default policy.
    My goal is to process only one request at one time through BS_A.
    In business service, BS_A I can see work manager and throttling options.
    My question is this:
    Scenario I: I make throttling enabled and set maximum concurrency=1 for BS_A
    Scenario II: I apply CustomWorkManager to BS_A
    Scenario III: I do both Scenario I and Scenario II
    What is the difference between I, II and III?
    Fundamentally, what is the difference between throttling with maxConcurrency=1 and MaxThreadConstraint of workmanager=1 for a http business service?
    Thanks and Regards,
    Swapnil Kharwadkar

    @Abhishek: Thanks for descriptive reply.
    @Anuj: Thanks for links, I am having a look..
    Use case:
    What is the target app/service? Is it DB, HTTP or anything else?
    Back end: Amadeus web services
    Role of DB:
    1. It will store data to attach transaction context to a request. This is to call more than one services in the backend - it is necessary for backend to understand in which context services are being invoked.
    For example, if I need to make PNR related changes, I need to invoke service X and fetch transaction context from back-end. The transaction specific identifier (read session) will be received in header part. After retrieve suppose I need retrieve PNR, I will invoke service Y. When I invoke, I need to put the transaction specific header part received in response of service X and then change body as per request format of service Y (read the response header of X will be the same as request and response header of Y) which will actually make changes and commit in the backend. (So back-end will understand that service X and Y are invoked as a part of single transaction, and transaction can be identified through logs)
    3. Once my X+Y call is over and transaction is committed, the context for transaction specific part received in header to the transaction is removed from back-end. Then I can use session again for the next transaction.
    4. To re-use session I am storing it in DB and retrieving as per need for each call to Amadeus.
    Problem is, it is absolute necessary for all transactions which are being processed simultaneously, to have unique session in header.
    For example,
    I do the following:
    Request 1: receives session from service X, uses for service Y. After use, inserts session in DB. Now context for that session is removed from back-end.
    Request 2: looks for session DB, puts in header and invokes backend. Context for Request 2 is attached to session retrieved from DB.
    Request 3: looks for session DB, puts in header and invokes backend. Context for Request 3 is attached to session retrieved from DB.
    As you can see if Request 2 and Request 3, pick up the same session from DB and invoke back-end, back-end services won't be able to understand which request the session belongs to, and will fail both requests. Ideally Request 2 should retrieve it from DB use for itself and Request 3 should make a call to service X at back-end to receive context. With this new context Request 3 should proceed for transaction.
    Why are you using a BS to call from one Proxy to another Proxy?:
    1. To interact with DB, I use DBAdapter business services with QueryByExample/Update/Insert operation.
    2. My PS_A is proxy which orchestrates these operations. (Read: SelectandUpdateDBForSessionRetrieve, UpdateDBWhenTransactionOver functionaries) Since there are two admin and four managed servers, all copies of PS_A will try to access DB simultaneously, and concurrency will fail.
    3. Hence I made BS_A on the basis of PS_A. BS_A is deployed on all four managed servers, used Load Balancing Algorithm as "None" and gave hard-coded urls of four managed servers in sequence of MS1, MS2, MS3 and MS4.
    4. Idea is if MS1 is ok, all requests will go to BS_A of MS1 only, and if somehow if I make it single threaded *(Read from DB+mark retrieved data as "in use" so other request can not use it)*, concurrency issue will not arise. In case MS1 is down, the requests will automatically forwarded to MS2 and since that is also single threaded, concurrency issue won't arise. In short both fail-over and concurrency can be achieved with BS_A making out of PS_A.
    The problem as you have correctly pointed out, is that OSB is stateless and one request has no relation with another. Somehow, I need to make every retrieve/update/insert to database as single threaded, i.e. once one is done then another should not be done at the same time. Else entire point of this pooling will fail.
    Please share any thoughts you might have. Even another approach to handle this single threaded need will do.
    Thanks and Regards,
    Swapnil Kharwadkar

  • Error while creating azure service bus connector

    Hi,
    I get below error while creating SB connector-
    {"status":"Failed","error":{"code":"ResourceDeploymentFailure","message":"The resource operation completed with terminal provisioning state 'Failed'."}}
    Screenshot below-

    Unfortunately it still fails with same error. It took quite a long time before failing.
    {"status":"Failed","error":{"code":"ResourceDeploymentFailure","message":"The
    resource operation completed with terminal provisioning state 'Failed'."}}

  • What are the differences between Oracle Service Bus 10g and WLI 10g?

    Hi,
    To me both Oracle Service Bus 10g R3 and Weblogic Integration 10g seem to offer the same functionalities for implementing an enterprise middleware.
    I would be grateful if someone could:
    1. provide me with the two products' differences.
    2. describe what their roadmap is?
    3. what are their positioning in the Oracle product catalog? Are they both members of Oracle SOA Suite? Fussion Middleware?
    Thanks a lot,
    Best regards,
    Babis.

    Thanks everyone for taking the time to reply,
    Eduardo: the answer to your questions are that all the flows will be short-lived but if we can make long-lived flows then we might consider developing them. We would need to persist the state of the flow somehow.
    I understand that some of our requirements would be better accomodated by WLI or bpel but we don't have an option but only to use OSB.
    So, do you think we could overcome the stateless nature of OSB by:
    1. writing to appropriate tables and reading from there and calling plsql procedures from the flows
    2. using JMS queues.
    In detalis:
    1. Regarding the writing/reading from Databases (in our case it would be oracle 10g R2 - probably RAC), is there something like a Database control in WLI, which we could use in OSB? What i have seen are using xquery execute-sql function or a JCA DB adapter but both of them seem to me not very easy to use. Is there another option?
    2. Regarding the JMS, in case that i want:
    a service that writes to a JMS queue what are the servicetype and transport that i should use?
    a service that reads from a JMS queues what are the service type and transport that we should used?
    Any information that you may share with me in the design and implementation of the above would be great.
    Thanks a lot.

  • How to publish an image and consume the same via web service?

    how to publish a soap web service which returns image and consume it via a client to display it properly?

    You could try to write a web service that returns a byte array and convert the image to bytes, and convert it back into an image again.

  • Create a web service from java bean and map exceptions to SOAP faults

    Hi,
    We have to expose our Session stateless EJB3 as web services. I've tried to use annotations and jdev wizard "java bean to web service" and it works fine.
    Our problem now is that our methods can throw a business exception that contains a list of error message strings to be presented on the client.
    I did not find any way to use annotations to make it build a wsdl with soap fault mapped to our exception class. Neither I could to make the wizard to create wsdl with faults.
    As we are exposing already designed and implemented classes as web services, I think the bottom-top (java->wsdl) approach is better that top->botton (wsdl->java). Therefore, I'm looking for a possibility to generate the web services from the java beans and have the exception be mapped to a soap fault message.
    We are using jdev 10.1.3.1 and OAS 10.1.3.1., is there a way to map exceptions to soap faults using bottom->top approach?
    thank you

    A couple of links that may be of help:
    http://www.netbeans.org/servlets/ReadMsg?listName=nbj2ee&msgNo=1218
    My last question concerning web services:
    I have already written a session bean and I'd like to add some methods
    as a web service to it, how do I do that?
    Or I can only create another bean for a webservice and cannot modify the
    original one?You might create web service with existing sources and select you bean. New web services with appropriate lookup method will be generated.
    All web service method, that will be exposed in web service, you
    should add itself (Pop-up menu Web Service -> Add operation)
    http://usersguide.netbeans.org/files/documents/40/73/Chapter9-WebServices.pdf

  • Some concept confused for Azure Service Bus EventHub

    Currently, I’m trying to use the Azure Service Bus Event hub and I have some concepts a little bit confused:
    I have create an event hub (our requirement is send 10Kb data per seconds to the event hub), the hub include 10 partitions, then we receive the data using the
    EventHubReceiver, when I create the instance for the EventHubReceiver, it need the
    PartitionId, so I want to know which partitionId is needed?
     I guess all the Partitions have the same data which I sended, is it right?
    Is the PartitionId equals PartitionKey? My understanding is the PartitionId is the indicator for the Partitions in the Event Hub, the PartitionKey is the indicator for the device which send the data, so one Partition can contains many partitonIds,
    is it right?
    When we receive data from hub, we need set the Consumer Group, so what is the relationship between EventHub and Consumer group?
    When we use the EventProcessorHost to receive data, we do not to set the PartitionId, so the data we got is the all PartitionData?
    When we call the PartitionContext.CheckpointAsync(), the Event hub will do the things to release the Events(delete, clear or sth) by itself, we needn’t do it in our code,
    is it right?
    Is there a diagram to show the relationship for concepts of the EventHub?
    Thanks a lot!

    I'd ask them over here.
    Azure forums on MSDN
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Oracle OSB 11G. Unable to find Oracle Service Bus Configuration Page.

    Hi All,
    Sorry for the apparent silly question but I am studying and learning the product.
    I have the OSB 11G installed and running with a proxy service working and routing requests. The Oracle ESB documentation http://download.oracle.com/docs/cd/E21764_01/doc.1111/e15866/ui_ref.htm#i1327746 at chapter 4.4.2 New Oracle Service Bus Configuration Project Wizard
    Use this wizard to create an Oracle Service Bus configuration project. For configuration options, see Section 4.4.3, "Oracle Service Bus Configuration Page."
    4.4.3 Oracle Service Bus Configuration Page.
    I don't see the configuration page in anywhere in the left pane of the console. Am I missing something? The project creation works fine but I just don't see the configuration Wizard.
    Thanks.
    Regards
    Salvatore Ilardo

    The link which you are referring is for user interface objects in the Oracle Service Bus plug-ins and OSB plug-ins are used with OEPE (Oracle Enterprise Pack for Ecplise) for OSB development. OEPE is the only supported IDE for OSB development as of now.
    Remember, at a time, one and only one Oracle Service Bus Configuration project can be deployed in a OSB domain which may contain desired number of Oracle Service Bus Projects and that's why there is no provision of creating Oracle Service Bus Configuration Project in sbconsole GUI. In IDE, you may create many Oracle Service Bus Configuration Project and that's why it has a Oracle Service Bus Configuration Project Wizard.
    Regards,
    Anuj

Maybe you are looking for

  • I noticed that Phone call, is getting disconnected often while on the wheel.

    Any one have noticed this problem while using your iPhone: While you are travelling (on the wheel) and attending a phone call, while your the cell phone receives signal from telecom network tower to tower, your phone call get disconnected automatical

  • Adobe CC 2014 Release crashes at Startup

    A co-worker is experiencing issues with Indesign CC 2014. It just started this morning after she did the latest update yesterday. Her system is an HP Windows 7, 32-bit OS with 4GB of RAM. But before the update she had no problems. We followed some su

  • HOW TO GET TOP AND BOTTOM RECORDS IN SQL STATEMENT, URGENT

    Hi, I want to get the TOP 2 and BOTTOM 2 records (TOP 2 SAL , BOTTOM 2 SAL) from the following query result for each department . How do I get it using a SQL statement ? Thanks SQL> SELECT A.DNAME, B.ENAME, B.SAL FROM DEPT A, EMP B WHERE A.DEPTNO = B

  • Virtual column partitioning - explain plan takes lot of time.

    I have some problem with table with partitioning based on virtual column. Explain plan generates for some simple select 2-5 minutes, but the same select but without part of where clausule generate in secounds. In both query there is the same explain

  • Numbers document not synchronized via iCloud

    I am saving document from Numbers MacMini but it's not visible from iOS devices or via iCloud.com. Instead I see the old version of the same document. When I am opening it in MacMini I see it in iCloud area, but in iCloud.com it shows the old version