Software in the cloud: The Relay Service

I’m now back from a trip to Seattle a few weeks back where I attended a huge week-long Microsoft internal technical training event.  I presented three times during the week, two of the presentations were “Software in the cloud” sessions which received fantastic feedback.


The premise of these sessions was to paint a view of how software solutions may look in the future if they were to leverage cloud based services such as SQL Server Data Services (SSDS) and BizTalk Services (Cloud Workflow, Identity and Connectivity).


I presented a fictional but realistic architecture using today’s technologies and discussed the challenges, I then presented a forward view on how you might approach the same problem using cloud based technologies and how this solves a number of challenges today and opens up completely new opportunities which for the most part aren’t possible today.


I’m going to present this scenario and the resulting solution in a series of blog posts, this being the first.


Before we get started I want to introduce the BizTalk Services Relay which by itself is incredibly powerful but often overlooked.  There is an SDK to download and play with via http://www.biztalk.net


So, if I have a Service offering today, say Credit Scoring functionality, it’s hard to enable business partners to invoke this service, especially if your organisation doesn’t host things out on the internet regularly. 


You’ve got any number of options generally involving any combination of leased lines, VPNs, proxy configuration, etc.  The key point here is that you must put in infrastructure and/or specific configuration for each business partner that wishes to leverage your service, and of course vice versa, each business partner will have to do the same to enable messages to pass out of their corporate boundary.


So, imagine a technology that enabled you to avoid all of this infrastructure/configuration whilst still maintaining security and integrity of messages passing between the organisations?


This is where the Relay comes into play; the first step is for your WCF service to register it’s endpoint with the cloud based relay service, a valid BizTalk Services account will be required to register an endpoint under the users namespace.  This step is shown below as step number 1.


The endpoint address will use a specific “service bus” prefix, e.g: sb://connect.biztalk.net/services/darrenj/OrderService/



Once an endpoint has been registered with the relay service it must be kept alive otherwise the socket could of course timeout.  This is done through a series of “ping” messages automatically passed under the covers between the relay service and the endpoint.


Once an endpoint is registered a client can then invoke the service, within Visual Studio you can simply type in the sb:// prefixed address via the usual Add Service Reference dialog and the proxy will be automatically created and configured – neat!


The proxy can then use the contract as usual, once invoked the message will be passed to the endpoint registered in the cloud (shown as number 3 in the diagram above) which will in-turn pass the message on to the service (shown as number 4 in the diagram above), the reverse then happens with the response (shown as number 4 in the diagram above).


In essence this is a straight forward message relay pattern with all messages passing via the relay, enabling two parties to exchange messages where they otherwise wouldn’t have been able to.


This works fine, but it would be nicer (and probably quicker) if we could enable both parties to communicate directly but the firewalls won’t allow this.  However the relay service knows quite a bit about the two parties.


When the service registered itself with the relay, the relay can see which dynamic port number the hosting organisation’s firewall is using for this communication session.  When a client communicates with the relay, the relay can again see the dynamic port number being used.


By sharing the port numbers with each party the relay can effectively step out of the way and enable both parties to communicate with each other after this initial port handshaking, this is depicted below and is explained in better detail in this great article



This process is called NAT traversal and is used by many things today including MSN Messenger, Groove, Skype, etc.  Some firewalls may not allow NAT traversal at which point the relay will fall back to the original relay pattern.   As long as both parties can see the internet and therefore the relay service then we’re in business!


This is a big step forward from today where you have to provision and configure network infrastructure such as Proxies, Firewalls, Private Network Links, VPNs, etc. whenever you wish to expose invoke services between organisations.


With this relay service you can break down your corporate barriers to communicate across organisations and through the relay you can also utilise non-durable publish/subscribe messaging effectively publishing business “events” which others can subscribe to.


So how about security?  Firewalls are there for a reason and you typically aren’t allowed to punch holes through them.  Access to any services exposed through the relay is restricted through the BizTalk Services provided implementation of a Security Token Service (STS) and messages can be secured as you require using encryption of the payload and digital signatures.


So, it must be hard to host a service through the relay?  Well not really, it’s just a bit of WCF configuration on your service an example of which is shown below:


<system.serviceModel>


 


  <bindings>   


    <relayBinding>


      <binding name=default allowBrowsing=true sendTimeout=01:00:00 


               connectionMode=RelayedDuplexSession>


      </binding>


    </relayBinding>


  </bindings>


 


  <!– Service endpoint using the BizTalk Services relay –>


  <endpoint


    address=“”


    binding=relayBinding


    contract=PaymentService.IPayment


    behaviorConfiguration=relayBehavior


    bindingConfiguration=default/>


  <behaviors>


    <endpointBehaviors>


      <behavior name=relayBehavior>


        <transportClientEndpointBehavior credentialType=UserNamePassword>


          <clientCredentials>


            <userNamePassword userName=USERNAME password=PASSWORD/>


          </clientCredentials>


        </transportClientEndpointBehavior>


      </behavior>


    </endpointBehaviors>


  </behaviors>


</system.serviceModel>


You don’t need to include the custom endpointBehavior in all cases, if you don’t then CardSpace will pop up to authenticate you and validate that you have permission to register a service at the specified endpoint – not ideal for non-interactive services J


Hopefully that’s given you a good flavour of what the relay service can do, it’s a fantastic piece of technology and opens up the opportunity to break down the enterprise SOA barriers whereby your services can only be consumed or exposed within your corporate boundaries.


To my mind, this opens up some great new opportunities for solutions moving forward, as we’ll see in my next few blog posts J

Brian’s Travel Blog: Jordan

OK, keeping with the recent theme, here’s another entry in my travel blog 🙂 Very soon I will get back to technical posts, I have some pent-up ones waiting to be written, some about BizTalk and some about Oslo, so stay tuned!

We recently completed the design/planning stage for the Jordanian government ESB project. It has been an honor to work with such a talented team, and as part of the planning process we did a non-trivial amount of development, solving some very tough problems along the way. I made several trips to Amman over the past year, and took full advantage of being there by seeing as much as I could of the country in the time I had. I have been saying that I have seen more of Jordan than most Jordanians have. A Jordanian challenged me on that, and I started listing off some of the things I’d done, and…. well…. it sounded like a blog post, particularly when he agreed that he had not seen many of these places 🙂 It’s was quite difficult for me to pick “high points”, as I thoroughly enjoyed the opportunity to see the country and region. However, I did it, and here is my list (photos below) of “do this if you go” for Jordan:

Petra Voted in last year as one of the new seven wonders of the world, the “rose red city carved out of the mountains”. I went there twice, once alone and once with my wife. Truly an amazing place, and well deserving of the title. However, with the new recognition comes more tourists, there were definitely more people there this year than last year.
Wadi Mujib preserve I did something like this in Utah a few years back, and it was called canyoneering. Basically, an all-day hike through the desert, much of it in a river (sometimes deep) the high point of which was rappelling down a 75 foot (25 meter) waterfall. An incredible experience.
Aqaba, and how I got there Aqaba is at the south end of Jordan, and is a major economic zone/shipping port on the Red Sea. I heard there was a locals bus that went down there, so I did the 5 hour trip that way. I was the only North American (and non-Arab) on the bus, it was a unique experience, one that I suspect would have made many North Americans feel uncomfortable, but as I enjoy “going local” and being outside my comfort zone, and this experience certainly did both.

The reason I went to Aqaba was to see it, and to also do my first scuba diving in the Red Sea.

Irbid, Um Quais and Jerrash This was a tour of northern Jordan, and some amazing Roman ruins (Jerrash was a major/important Roman city, and is one of the largest and most well preserved sites of Roman architecture in the world outside Italy)
Dead Sea I actually got there three times, once to see it, another time it was my “base camp” for the Wadi Mujib hike, and then I stopped there with my wife so she could experience floating ON the water. If you go, be really careful not to swallow any of the water or get it in your eyes. It’s about as pleasant as swallowing an acid.

On my first trip, I did a side trip to see the Christ baptism site, with is about a half-hour away from the hotel area. While there, I could have literally jumped across the Jordan river and been in Israel, but the proliferation of guys with machine guns made me think that could be a Bad Idea.

Wadi Rum This is the desert where Lawrence of Arabia was filmed. I hired a private guide and we 4-wheeled throughout the desert, rode a camel, spent the night in a Bedouin encampment, etc. I learned a lot about their lifestyles and history, and, being a desert person, felt right at home.
Amman Citadel More impressive ruins, and a great antiquities museum. I spent a ton of time in the museum, as they had some impressive artifacts/explanations.

I was there the day before Barack Obama came, and it actually went into security lockdown while I was there. People inside could stay, but nobody else was allowed in. Security (army I think) was posted every 30 feet.

The Jordanian people themselves were awesome. I had heard before going there that most Jordanians speak English, and those that don’t will still invite you into their homes for tea. I found them to be very kind, generous and helpful. The only possible exception to this is the taxi drivers who always seem ready to play “shaft the tourist”, however, once I got the hang of how to deal and they saw I was a pseudo-local who knew how to play the game, they got more pleasant. Also, as I just recently found out, the Jordanian taxi drivers are really laid back and friendly compared to what I saw in Egypt!

I have a bazillion pictures of everything I did, here are some of the highpoints:

From Wadi Rum:

From the Amman Citadel

From Jerrash:

From Umm Qays, the middle photo shows the Golan Heights behind me, with Syria just to my left:

I had to work on my TechEd presentation one weekend, which sucked, but hey, if you HAVE to work a weekend, then why not do it at a really nice hotel on the Dead Sea? The first picture is that weekend, the others are from another visit to the area.

Pictures from Petra:

From Wadi Mujib:

Lastly, in case you were wondering about American cultural exports, you can find things like the Colbert Report, the Daily Show and Family Guy in Jordan. Here’s Jon Stewart, with Arabic subtitles:

Technorati Tags: Travel,Jordan,Middle East

Screencast: Your first state machine workflow

Screencast: Your first state machine workflow

In the latest screencast in the ongoing series, I cover the basics of creating a state machine workflow. I show you the various activities to use, how to transition between states and handle events including time based events. 

Screencast: Creating Your First State Machine Workflow

 

First state machine workflow

 

Previous screencasts in the series:

 

RSS feed for all screencast posts

Screeencast: Your first sequential workflow

Screeencast: Your first sequential workflow

As Aaron pointed out a while back, Pluralsight has joined up with the WCF / WF folks at Microsoft to create a series of screencasts to give developers an introduction to these technologies.  My first contribution to this effort is all about creating a your first sequential workflow.  The screencasts shows the basics of creating the workflow, adding activities from the framework and custom activities. 

 First sequential workflow

RSS feed for all WF screencasts

Upgrading BizTalk 2006 to BizTalk 2006 R2 – New EDI components not available

An issue that I recently came across was when we upgraded our servers from BizTalk 2006 to BizTalk 2006 R2 is that we were unable to see the new EDI features. This is the context menu I saw when right clicking the parties:

Which is incorrect, I should be seeing this context menu:

The resolution is that after you upgrade the server, you need to need to modify the installation in the add/remove programs and choose Modify:

Check the BizTalk EDI/AS2 Runtime:

Afterwards, you need to go into the BizTalk Configuration and configure the new EDI components (I already did this):

Then you get all of the components you are looking for.

Authentication and Authorization of Incoming SOAP Requests to BizTalk

Authentication and Authorization of Incoming SOAP Requests to BizTalk

I’ve been meaning to write a blog on this subject for quite some time… this blog will explain authentication and authorization of incoming SOAP messages to BizTalk. Although it might seem like a simple subject to some, I’ve seen enough web apps deployed w/o authorization that I figure it’s worth writing about…
Here’s the short answer […]

How To Create a Portable Office (Content)

Content is king!  Just ask anyone who is serious about the web and they will tell you, unless they’re in the midst of getting you to sign away your content at the moment.  As a consultant or other person on the go, you should be ready to capture content at a moment’s notice.  Now, I do a ton of community work, so I probably take this to extremes, but you should consider these options.

Video Capture

Video Camera

A picture is worth a thousand words, but a video is king.  Be it user groups, scrums, product demos or anything else having a video camera close at hand can solve a ton of problems.  I carry a nice cheap video camera in my backpack which I picked up during a Black Friday sale.  My unit is a Panasonic PV-GS85, which has a great built in LED light which can help with close up camera work in dark rooms.  The model is not important, they key here is that having some sort of video capture really helps.  There are three levels of video cameras these days.  Flash, Tape, and Hard Disk. 

Mine is a tape unit, that records to Mini-DV.  This means I can record a lot, about 1.5 hours per tape, but it means I’ve got to rip the tape back to digital files at 1:1 speed when I’m done, which means 1.5 hours of recording is 1.5 hours of ripping.

Flash units store less, but also store as digital files so they transfer to a computer much faster.  These can also be very small sometimes, which is nice.  They can also be cheaper than tape.

Hard disk units are more expensive, and about the same size as tape units but they also transfer to your computer faster because, again, they are storing files to that hard disk.

On all of these, when you get a unit realize you’re not trying to film a movie, O.K. quality will likely be fine.  Good enough, is by definition, good enough.

Mono-pod

Video cameras are great, but shaky video isn’t.  I carry a mono pod in my backpack that I can whip out whenever I need to stabilize a video.  These gizmos are handy, but remember that mono means 1, that’s 1 leg, which means no walking away.  For walking away you’ll need…

Large Tripod

I bought a “large” tripod at my local camera shop.  It stays in the car, to big for the backpack, but it is still relatively nearby if I need to record a longer session.  Usually I know this on my way in and will carry it with me.  I’ve made a habit of recording our company meetings for Sogeti so that they can be shared on our SharePoint portal.  This has worked great for me.

Small Tripod

But sometimes you want to walk away, and haven’t got time to get the large tripod.  For this, we use the wonderful QSX 1001 tripod.  This tripod packs up into a 2 inch diameter, 7 inch long tube.  It rides in the water bottle pocket of my backpack, and is always ready to be pulled out.  Now, even fully extended this only rises to a height of about 12 inches, but resting on a table this is perfect for interviews.

Web Camera

Sometimes the full camera isn’t what you need, instead its time to participate in a Live Meeting session or other Webcast and you just need a web camera.  I carry a Microsoft LifeCam NX-6000 for this.  I’m a fan of this unit, but it’s drivers are enough to drive me crazy.  The drivers install a service (MSCAMSVC.exe) which can start consuming tons of CPU cycles even when the camera is disconnected.  I now keep the service disabled until I plug in the camera.  What I really need is a better Web Cam at some point that lacks these problems.  This unit is workable, just realize you’re going to have to seize control of that service of your box will seriously suffer.

Audio Capture & Playback

Sometimes you don’t need video, and audio alone will be plenty.  Sometimes you just want to listen to some tunes while you’re cruising along to your code.  Here are my tools for this.

MP3 Player

We all need tunes, and we want them on the go.  While I own Zunes and iPods, as Alton Brown says, I hate unitaskers.  The Creative Zen V Plus, I’ve used for years and remains the staple generic MP3 player in my work backpack because it not only plays WMAs, MP3s, and Audible audiobooks, it also has a built in recorder.  Now, this isn’t super high quality audio, but if you’ve got a morning Scrum that you need to record, or if you need to write yourself a verbal note, then this is the unit for you.

Audio Recorder

If podcasting is your goal, then the Zen V Plus won’t be up to the quality you want.  You need a good quality recorder which can capture audio in multiple different ways.  For my purposes, this is the Zoom H4.  This unit can record with its two built in microphones, it can accept two direct inputs from guitars or other instruments, or it can take two XLR microphones and provide them up to 48V of phantom power.  Best of all, it just plugs into your computer for retrieval of the information, and stores to common SD memory sticks.  It also comes with its wall socket adapter, or can run portably with 2 AA batteries.  I use this for my podcasting efforts, and have been very happy with it so far.

Listening

When you’re done capturing, you’re gonna want to listen to all that wonderful content.  I’ve raved in the past about the Logitech Freepulse headphones, and I’d still recommend them.  The customer power scheme still bothers me though.

Image Capture

There are more than cameras to image capture…

Cameras

No cameras are in my backpack, at the current time the camera in my phone has always been enough for what I’ve needed.  When I vacation I might add my wife’s camera, but otherwise camera phones are the key here.

Scanners

The technology most locking down the modern mobile office is fax.  There are a bunch of service options for this, but those services don’t also help with the problem of being handed a piece of paper that you want digitized into OneNote or other computer note taking software.  For this, I carry the Pentax DS Mobile 600 which is a wonderful, USB powered, color scanner.  This unit will rip through your pages of hand written notes and digitize them for your digital consumption.  Fair warning, at the current time there are only 32 bit drivers for this unit.

Give back with Kiva and GiveCamp

So you need only flip back about a year ago on this blog to find that I am clearly a fan of pushing people to contribute to their community, and their world, in a positive way.  I was a huge proponent of the We Are Microsoft event last January that has since morphed into the GiveCamp initiative nationwide.  I’ve been thrilled to watch that effort franchise itself around the United States, and am sure that it will reach further will.  GiveCamp’s are based on the idea of using our skills, as developers, to impact a local charity in a positive way.  This is an incredibly high touch, high impact donation of skills that many charities simply lack.  But at its heart, it is about giving back.  So what can we do between GiveCamps?  How can we impact our community and our world in a tangible way without picking up and doing three years of field work around world?

Well the truth of the matter is that in between we need to work closely with those people who are on the ground around the world and know where impact can be created.  Kiva.org is an organization that lets us do exactly that.  They are a micro-financing group who helps bring small loans to people throughout the world.  While a $50 dollars might buy you a new video game for your XBox 360, it will also help fund two different loans to entrepreneurs around the world.

What is Micro-Financing?

Micro-Financing is about helping lend money directly to entrepreneurs around the world which can make a real impact to their local economy.  It is based on the principals of capitalism, and can be explained much better by sites such as WikiPedia or Kiva themselves.

How does Kiva help?

Simple, they work with partner organizations on the ground to make known to you the needs of these entrepreneurs.  They provide a way you can work with others to finance such a loan.  They handle collecting those funds and returning them to you.

GiveCamp @ Kiva.org

I’ve created what Kiva calls a Lending Team for GiveCamp on Kiva’s website.  Through this team we can contribute to these entrepreneurs as well as track our impact over time.  This is a long term effort, but even $25 can really help change the lives of those involved.  Go to Kiva.org, create an account, join the team, and look for someone in need of a loan that you would be willing to back.  I’ve already got a handful of loans out there.  A word of advice though, join our Lending team first, before you fund a loan, because it will only be counted towards the team if it is made after you join.

Absolutely no skin in this game…

I want to be very clear, there is ZERO personal profit motivation for me in this.  Teams are merely a community building effort and there is nothing about making a loan as part of the GiveCamp team that in any way accrues to the personal benefit of myself, or anyone else.