• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk Server to create hybrid solutions
 

Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk Server to create hybrid solutions

on

  • 1,863 views

The Service Bus is part of Windows Azure and is designed to provide connectivity, queuing, and routing capabilities not only for the cloud applications but also for on-premises applications. Microsoft ...

The Service Bus is part of Windows Azure and is designed to provide connectivity, queuing, and routing capabilities not only for the cloud applications but also for on-premises applications. Microsoft BizTalk Server enables organizations to connect and extend heterogeneous systems across the enterprise and with trading partners. Using both together enables a significant number of scenarios in which you can build secure, reliable and scalable hybrid solutions that span the cloud and on premises environments.

Windows Azure BizTalk Services is a simple, powerful, and extensible cloud-based integration service that provides Business-to-Business (B2B) and Enterprise Application Integration (EAI) capabilities for delivering cloud and hybrid integration solutions. Windows Azure Mobile Services accelerates connected client application development by streamlining common backend tasks like structuring storage, authenticating users, and sending push notifications. In this session you will see how to integrate these technologies to build secure, reliable and scalable hybrid solutions that span the cloud and on premises environments.

Statistics

Views

Total Views
1,863
Views on SlideShare
1,863
Embed Views
0

Actions

Likes
0
Downloads
24
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • This slide is required. Do NOT delete. This should be the first slide after your Title Slide. This is an important year and we need to arm our attendees with the information they can use to Grow Share! Please ensure that your objectives are SMART (defined below) and that they will enable them to go in and win against the competition to grow share. If you have questions, please contact your Track PM for guidance. We have also posted guidance on writing good objectives, out on the Speaker Portal (https://www.mytechready.com).  This slide should introduce the session by identifying how this information helps the attendee, partners and customers be more successful. Why is this content important?This slide should call out what’s important about the session (sort of the why should we care, why is this important and how will it help our customers/partners be successful) as well as the key takeaways/objectives associated with the session. Call out what attendees will be able to execute on using the information gained in this session. What will they be able to walk away from this session and execute on with their customers.Good Objectives should be SMART (specific, measurable, achievable, realistic, time-bound). Focus on the key takeaways and why this information is important to the attendee, our partners and our customers.Each session has objectives defined and published on www.mytechready.com, please work with your Track PM to call these out here in the slide deck.If you have questions, please contact your Track PM. See slide 5 in this template for a complete list of Tracks and TPMs.
  • So let's talk about those last three needs our developers have. If you are in the cloud, firewalls are less cumbersome. Application developers can put data in code in geographical locations that make it very fast.  Let's say your business sells Italian pasta, and your sales are growing, your users in Italy have great service because your servers are really close. So you can preload your data on servers in other geographical locations to improve speed and access. Otherwise the transaction needs to hop across the fiber optic, adding a little more latency. Also – You can have the cloud doing the heavy lifting so your phone/device/pc equivalent doesn't.
  • RDFE (RedDog Front End) is the publicly exposed API which is the front end to the Management Portal and the Service Management API (ie. Visual Studio, Azure MMC, etc). All requests from the user go through RDFE. FFE (Fabric Front End) is the layer which translates requests from RDFE into the fabric commands. All requests from RDFE go through the FFE to reach the fabric controllers.ARR: Application Request Routing
  • SQL Azure has a cool export feature that creates a ‘.bacpac’ file that contains your schema and your data – it saves the file to blob storage. And what’s more, they have a service endpoint with a REST API.This means it’s easy for me to invoke an export from a Mobile Services script, even better, I can use the scheduler to do a daily backup.Here’s the script I use; notice how the URL of the export service varies depending on the location of your database and server. Call the Import/Export Service via REST Endpoints. This method starts the Import/Export Service programmatically and triggers an export from Windows Azure to Azure blob storage.See http://code.msdn.microsoft.com/windowsazure/Windows-Azure-SQL-Database-5eb17fe2 and http://msdn.microsoft.com/en-us/library/windowsazure/jj900675.aspx.
  • Read: GET method Add: POST method Update: POST method Delete: DELETE method
  • Read: GET method Add: POST method Update: POST method Delete: DELETE method
  • Speakers should use this slide to identify content, related to their presentation, being offered in other sessions or labs at TechReady. Your Track PM can provide a full listing of all of the sessions, webcasts, hands-on labs and instructor-led labs in your track, as well as the other tracks.If there is additional content available that attendees should know about, please add a section for Additional Resources to the slide. In this section you can call out whitepapers or websites that you and your team have created.If you have questions, please contact your Track PM. See slide 5 in this template for a complete list of Tracks and TPMs.

Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk Server to create hybrid solutions Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk Server to create hybrid solutions Presentation Transcript

  • Enterprises want to manage internal mobile apps and consumer facing event- or productspecific mobile apps from the same portal as core LOB apps Small Businesses require solutions that accelerate development time and decrease development costs. Developers shouldn’t have to constantly reinvent the wheel and reproduce common backend functionality Consumers expect a continuous experience across all devices
  • Windows Store iOS Android Windows Phone 8 iOS Android HTML 5/JS SDKs ServerSide Scripts Custom API Scheduler
  • Operation Login Query records Insert record Update record Delete record Description Gets the user ID for a supplied authentication token. Queries data in a table. Inserts a new record into a table. Updates an existing record in a table. Deletes an existing record from a table.
  • 1. The HTML5/JS or Windows Store app sends a request to a custom API 2. 3. 4. 5. 6. 7. 8. 9. using the InvokeApi method of the MobileServiceClient class. The custom API sends a request to ACS to acquire a security token. ACS issues and returns a security token. The mobile service performs the following actions: • Creates a SOAP envelope to invoke the WCF service. The Header contains a RelayAccessToken returned by ACS. • Uses the https module to send the SOAP request to the Relay Service. The Relay Service forwards the request to WCF service. The WCF service exposes a BasicHttpRelayBinding endpoint on the Service Bus. It reads/writes/updates/deletes data from a local db. The WCF service returns a response to the Relay Service. The Relay Service forwards the message to the mobile service. The custom API uses the xml2js Node.js module to change the format of the response SOAP message from XML to JSON. The mobile service returns data in JSON format to the client app.
  • var var var var namespace = 'your-servicebus-namespace'; issuerName = 'owner'; issuerSecret = 'XXXXXXXXXXXXXXXXXXX='; https = require('https'); function getAcsToken(response, callback) { var options = { host: namespace + '-sb.accesscontrol.windows.net', path: '/WRAPv0.9/', method: 'POST' }; var values = { wrap_name: issuerName, wrap_password: issuerSecret, wrap_scope: 'http://' + namespace + '.servicebus.windows.net/' }; var req = https.request(options, function (res) { res.on('data', function (data) { var token = qs.parse(data.toString('utf8')); if (res.statusCode == 200) { if (token.hasOwnProperty('wrap_access_token')) { callback(token.wrap_access_token); } else { response.send(400, "[getAcsToken]: ACS didn't return a valid token"); } } else { response.send(res.statusCode, util.format('[getAcsToken]: %s', data)); } }); }); req.write(qs.stringify(values)); req.end(); req.on('error', function (e) { response.send(400, util.format('[getAcsToken]: %j', e)); }); }
  • function addProduct(token, request, response) { if (request.body.hasOwnProperty('name') && request.body.hasOwnProperty('category') && request.body.hasOwnProperty('price')) { var product = '<product xmlns:i="http://www.w3.org/2001/XMLSchema-instance">' + '<productId>0</productId>' + '<name>' + request.body.name + '</name>' + '<category>' + request.body.category + '</category>' + '<price>' + request.body.price + '</price>' + '</product>' var base64token = new Buffer(token).toString('base64'); var tokenId = uuid.v1(); var body = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' + '<s:Header>' + '<RelayAccessToken xmlns="http://schemas.microsoft.com/netservices/2009/05/servicebus/connect">' + '<wsse:BinarySecurityToken wsu:Id="uuid:' + tokenId + '" ' + 'ValueType="http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0" ' + 'EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ' + 'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ' + 'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' + base64token + '</wsse:BinarySecurityToken>' + '</RelayAccessToken>' + '</s:Header>' + '<s:Body>' + '<AddProduct xmlns="http://windowsazure.cat.microsoft.com/samples/servicebus">' + product + '</AddProduct>' + '</s:Body>' + '</s:Envelope>'; var headers = { SOAPAction: 'addProduct', 'Content-Type': 'text/xml' }; var options = { host: namespace + '.servicebus.windows.net', path: '/products/basichttp', headers: headers, method: ‘POST'};
  • var req = https.request(options, function (res) {res.on('data', function (data) { var soap = data.toString('utf8'); if (res.statusCode == 200 || res.statusCode == 201 || res.statusCode == 202) { var xml2js = require('xml2js'); var parser = new xml2js.Parser(); parser.parseString(soap, function (error, json) { if (error) { response.send(400, '[addProduct]: An error occurred while parsing the response.'); } else { try { var product = json["s:Envelope"]["s:Body"]["AddProductResponse"]["product"]; response.send(200, product); } catch (ex) { response.send(400, '[addProduct]: An error occurred while processing the response.'); } } }); } else { response.send(400, '[addProduct]: An error occurred while invoking the downstream service.'); } }); }); req.write(body); req.end(); }
  • 1. The HTML5/JS site or Windows Store app sends a request to a 2. 3. 4. 5. 6. 7. 8. custom API using the InvokeApi method The custom API sends a request to ACS to acquire a security token. ACS issues and returns a security token. The mobile service uses the https module to send a request to the Relay Service and specifies the wrap access token issues by ACS in the Authorization HTTP header The Relay Service forwards the request to the WCF service. The WCF service exposes a REST WebHttpRelayBinding endpoint on the Service Bus. It reads/writes/updates/deletes data from a local db. The WCF service returns a response to the Relay Service. The Relay Service forwards the message to the mobile service. The mobile service returns data in JSON format to the client app.
  • function addProduct(token, request, response) { if (request.body.hasOwnProperty('name') && request.body.hasOwnProperty('category') && request.body.hasOwnProperty('price')) { var product = { productId: 0, name: request.body.name, category: request.body.category, price: request.body.price }; var headers = { 'Authorization': token, 'Content-Type': 'application/json' }; var options = { host: namespace + '.servicebus.windows.net', path: '/products/webhttp/addproduct', headers: headers, method: 'POST' }; var req = https.request(options, function (res) { res.on('data', function (data) { var body = data.toString('utf8'); if (body) { console.log('[addProduct]: response body: ', body); } if (res.statusCode == 200 ||res.statusCode == 201 || res.statusCode == 202) { response.send(200, JSON.parse(body)); } else { response.send(400, '[addProduct]: An error occurred while invoking the downstream service.'); } }); }); req.write(JSON.stringify(product)); req.end(); req.on('error', function (e) { response.send(400, util.format('[addProduct]: %j', e)); }); } else { var message = "[addProduct]: The request body is not in JSON format or doesn't contain a well-formed product.in "; response.send(400, message); } }
  • • • • • • • • • • • The HTML5/JS site or Windows Store app sends a JSON request to a custom API. The custom API sends a request to ACS to acquire a security token. ACS issues and returns a security token. The mobile service performs the following actions: • Extracts the wrap access token from the security token issued by ACS and assigns its value the Authorization HTTP request header. • Creates a SOAP envelope to invoke the XML Request-Reply Bridge. • Uses the https module to send the SOAP envelope to the bridge. The bridge performs the following actions: outes the request to EUROPE or US service based on the value of the location prop. The Relay Service forwards the message to the target service. The service returns a response to the bridge via the Relay Service . The bridge transforms and returns the response to the mobile service. The custom API uses the xml2js Node.js module to change the format of the response SOAP message from XML to JSON. The mobile service returns data in JSON format to the client application.
  • var bridgePath = '/default/CalculatorService'; var bizTalkServiceScope = 'http://<your-biztalk-service-namespace>.biztalk.windows.net' + bridgePath; var https = require('https'); var qs = require('querystring'); function getAcsToken(response, callback) { var options = { host: ‘<your-service-bus-namespace>.accesscontrol.windows.net', path: '/WRAPv0.9/', method: 'POST' }; var values = { wrap_name: 'owner', wrap_password: 'XXXXXXXXXXXXXXXXXXXXXXXXXX=', wrap_scope: bizTalkServiceScope }; var req = https.request(options, function (res) { res.on('data', function (data) { var body = qs.parse(data.toString('utf8')); if (res.statusCode == 200) { if (body.hasOwnProperty('wrap_access_token')) { var header = 'WRAP access_token="' + body.wrap_access_token + '"'; callback(header); } else { response.send(400, util.format("[getAcsToken]: ACS didn't return a valid token")); } } else { response.send(res.statusCode, util.format('[getAcsToken]: %s', data)); } }); }); req.write(qs.stringify(values)); req.end(); req.on('error', function (e) { response.send(400, util.format('[getAcsToken]: %j', e)); }); }
  • function callCalculatorBridge(token, request, response) { if (request.body.hasOwnProperty('location') && request.body.hasOwnProperty('operations') && Array.isArray(request.body.operations)) { var operations = request.body.operations; var body = '<?xml version="1.0" encoding="utf-8"?>' + '<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" ' + ... '<operations>'; var items = new Array(operations.length); var index = 0; for (var i = 0; i < operations.length; i++) { if (operations[i].hasOwnProperty('op') && operations[i].hasOwnProperty('op1') && operations[i].hasOwnProperty('op2')) { body = body + '<operation>' + '<op>' + operations[i].op + '</op>' + '<op1>' + operations[i].op1 + '</op1>' + '<op2>' + operations[i].op2 + '</op2>' + '</operation>'; items[index] = operations[i]; index++; } } body = body + '</operations></request></s:Body></s:Envelope>'; var headers = {'Accept':'application/soap+xml','Content-Type':'application/soap+xml', 'Authorization': token}; var options = {host: 'babonet.biztalk.windows.net', path: '/default/calculatorservice',headers: headers, method: 'POST', agent: agent }; var req = https.request(options, function (res) { ... }); }); req.write(body, 'utf8'); req.end(); req.on('error', function (e) { response.send(400, util.format('[callCalculatorBridge]: %j', e)); }); } else { response.send(400, "[callCalculatorBridge]: The request body is not in JSON format or doesn't contain all the necessary fields."); } }
  • • • • • • • • • • • The HTML5/JS site or Windows Store app or Windows Phone 8 sends a JSON request to a custom API. The custom API sends a request to ACS to acquire a security token. ACS issues and returns a security token. The mobile service performs the following actions: • Extracts the wrap access token from the security token issued by ACS and assigns its value the Authorization HTTP request header. • Creates a SOAP envelope to invoke the XML Request-Reply Bridge. • Uses the https module to send the SOAP envelope to the bridge. The bridge performs the following actions: outes the request to the BizTalk Adapter Service via SB Relay. The BizTalk Adapter Service accesses data using the SQL Adapter. The BizTalk Adapter Service returns a response to the bridge via SB Relay. The bridge transforms and returns the response to the mobile service. The custom API uses the xml2js Node.js module to change the format of the response SOAP message from XML to JSON. The mobile service returns data in JSON format to the client application.
  • • The HTML5/JS site or Windows Store app or Windows Phone 8 sends a JSON request to an ASP.NET Web API REST service. The custom API sends a request to ACS to acquire a security token. ACS issues and returns a security token. The Web API service performs the following actions: • Extracts the wrap access token from the security token issued by ACS and assigns its value the Authorization HTTP request header. • Creates a SOAP envelope to invoke the XML Request-Reply Bridge. • Sends the message to the BizTalk Service using POST method. The bridge performs the following actions: • • • • outes the request to the BizTalk Adapter Service via SB Relay. The BizTalk Adapter Service accesses data using the SQL Adapter. The BizTalk Adapter Service returns a response to the bridge via SB Relay. The bridge transforms and returns the response to the Web API service. The Web API service returns data in JSON format to the client application. • • • •
  • 1. 2. 3. 4. 5. 6. 7. 8. 9. The client app sends auth credentials to the MS. The authentication provider validates the credentials (username and password) and issues a security token. The mobile service returns its access token to the client application. The user sends a new item to the MS. The insert script for the TodoItem table handles the incoming call. The script calls the authentication provider using the request module to retrieve the user name from the user token. The script sends a request to ACS to acquire a security token. The script calls BizTalk Server via a Relay Service to retrieve the user address. The script inserts the new item in the TodoItem table. The script reads the Channel URI of Windows Phone 8 and Windows Store apps from the Channel table. The script sends Push Notifications. The script uses the azure module to send a notification to BizTalk Server via a Service Bus queue.
  • function sendMessageToServiceBus() { var azure = require('azure'); var serviceBusService = azure.createServiceBusService('<your-service-bus-namespace-name>', '<your-service-bus-namespace-key>'); var queueOptions = { EnableBatchedOperations: true, RequiresDuplicateDetection: true, DuplicateDetectionHistoryTimeWindow: 'PT8H' }; serviceBusService.createQueueIfNotExists('mobileservices/todoitem', queueOptions, function (error) { if (error) { console.error("An error occurred creating/accessing the Service Bus queue: ", error); } else { var builder = require('xmlbuilder'); var root = builder.create('todoItem', { 'version': '1.0', 'encoding': 'UTF-8' }); root.ele('userId', user.userId); root.ele('text', item.text); root.ele('complete', item.complete.toString()); var message = { body: root.end({ 'pretty': true, 'indent': ' ', 'newline': 'n' }), messageId: item.id, customProperties: { source: 'Mobile Services', author: 'Paolo Salvatori' } }; // Send the message to the queue serviceBusService.sendQueueMessage('mobileservices/todoitem', message, function (error) { if (!error) { console.log('Sent message: ' + message); } }); } }); }
  • http://code.msdn.microsoft.com/windowsazure/How-to-integrate-a-Mobile-8780500c http://code.msdn.microsoft.com/windowsazure/How-to-integrate-a-Mobile-1ee6a5ea http://code.msdn.microsoft.com/windowsazure/How-to-integrate-Mobile-6718aaf2 http://code.msdn.microsoft.com/windowsazure/How-to-integrate-Mobiles-77b25d12 http://code.msdn.microsoft.com/windowsazure/How-to-integrate-Mobile-f2fca10d http://code.msdn.microsoft.com/windowsazure/How-to-send-a-large-c36ab70e
  • http://www.windowsazure.com/en-us/develop/mobile/ http://www.windowsazure.com/en-us/develop/mobile/resources-html/ http://code.msdn.microsoft.com/Upload-File-to-Windows-c9169190 http://blogs.msdn.com/b/carlosfigueira/archive/2012/10/25/getting-user-information-on-azure-mobile-services.aspx http://blogs.msdn.com/b/carlosfigueira/archive/2012/10/23/troubleshooting-authentication-issues-in-azure-mobileservices.aspx
  • http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/table-services/ http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/service-bus-queues/ http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/service-bus-topics/ http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/sendgrid-email-service/
  • http://blogs.msdn.com/b/paolos http://www.thejoyofcode.com/ http://www.nickharris.net/ http://blogs.msdn.com/b/carlosfigueira/