Generating swagger for azure functions until its available OOB

Please follow the steps below to generate swagger for Azure functions

  1. Get a fiddler/postman session working with your function so that you have the json ouput.
  2. Past the Json as class using the following in Visual Studiopastedimage
  3. Create a webapi application, configure swagger (the howto can be found here https://www.youtube.com/watch?v=LIhT6HIpLf8)and create a controller method with the necessary input and output values (no method implementation is necessary except for returning expected output)
            // GET api/values/5
    public List<Rootobject> Get()
    {
    return new List<Rootobject>();}
  4. Then just navigate to  http://yourapplication:portno/swagger  to make sure all the datatypes for your particular operation are shown accordingly.
  5. Then download the swagger file from http://yourapplication:portno/swagger/docs/v1  and save it to a file
  6. Then navigate to http://editor.swagger.io/#/ open the saved file (copy paste also works) and  add or remove what you need….

Hopefully this will help in saving some time…

Await methods are not supported in catch and finally block for .Net 4.0, solution ExceptionDispatchInfo

If you are using .net 4.5 and use async/await you will realize that you cannot await in the catch block, the new C# 6 language overcomes this limitation.

 

in .Net 4.5 you can us the ExceptionDispatchInfo to capture the exception and throw as required, example below

———————————————————————————————————————————————————

ExceptionDispatchInfo capturedException = null;

try
{
SomeMethodCall()
}
catch (Exception ex)
{
capturedException = ExceptionDispatchInfo.Capture(ex);
}
if (capturedException != null)
{

await LogExceptionMethod(), //log exceptions to an external endpoint

}

throw exception;

Why BizTalk

Some people still ask me why BizTalk, they say that they can spin up a windows service and do most of the stuff !!!, i basically tell them following OOB features apart from the main ones, and they say………………………………… oh

  1. Transactional pipelines
  2. Recoverable pipelines
  3. Pipelines that call the BAM interceptor API
  4. BizTalk Server adapter support
  5. Batching
  6. Retries
  7. Correlation set initialization
  8. Declarative configuration
  9. Secondary transports
  10. Tracking
  11. Declarative use of BAM

Extending Windows Azure BizTalk Services Using Message Inspectors

Extending Windows Azure BizTalk Services Using Message Inspectors

My blog on  Extending Windows Azure BizTalk Services Using Message Inspectors, posted on AIS site,

Access control service (SAML vs. SWT)

Access control services supports both SAML and SWT tokens, now what exactly is the difference between them

   

SAML

SWT

Protocol support

WS Trust, WS-federations (Soap based)

OAuth WRAP and OAuth 2.0 (HTTP REST)

Cryptographic differences

Tokens are signed using asymmetric keys (which provides CA verification, and revocation)

Tokens are signed using symmetric keys

Visual studio extension (context menu) for Azure Service Bus

As a part of my azure service bus learning, I always ended up creating console/win form/test projects for submitting messages to either a queue or topic. It was the same repetitive code always, but the following  always ended up being different…

1) Name of the Queue or Topic

2) key and issuer

3) Service Namespace

4) XML Bridge (EDI ??)

 

Being a BizTalk Dev/Architect for most of my IT career, we select files with right click for testing a map..etc, keeping this in mind, I came up with a visual studio context menu extension(on how-to will be another blog post), which does the following.

For any selected file in visual studio it can submit to either a queue or topic, the following image should be self explanatory.

 

image

For this release we need to have the following key/value pairs in the appsetting section of the project configuration file. The future release will include a property window or submenu.

 <appSettings >
    <add key="Topic" value="topictest"/>
    <add key="Queue" value="test"/>
    <add key="Issuer" value="owner"/>
    <add key="Key" value=""/>
    <add key="ServiceNamespace" value="/>
  </appSettings>

In the background I use a messagesender class to stream the files (it can be any type) to the service bus

// Read the selected file in the project  
// and pass this into the the brokedmessage constructor.
var fileStream = new FileStream(this.selectedFile, FileMode.Open);
using (var message = new BrokeredMessage(fileStream, true))
{
    messageSender.Send(message);
}

But what if we want an object to be published to a queue or a topic, Simple we serialize this to a file stream, include it into the project and send it to the queue, how?

private void SerializePizza()
{
  DataContractSerializer ds = new DataContractSerializer(typeof(PizzaOrder));
    using (Stream s = File.Create("pizza.xml"))
     {
       ds.WriteObject(s, this.GetOrder());
     }
 }

And in the receiver we de serialize that back into the pizza object.

XmlObjectSerializer cc = new DataContractSerializer(typeof(AzureAddin.PizzaOrder));
 Console.WriteLine(string.Format("Pizza Quantity: = {0}", 
message.GetBody<AzureAddin.PizzaOrder>(cc).Quantity));

 

Note: This is the first release we will be adding more functionality in the future releases

1) A Property grid for selecting the topic, subscription or the queue

2) A collection property to specify the BrokeredMessage properties

3) Subscription support.

4) EDI Support

You can download the extension from the MSDN site

http://visualstudiogallery.msdn.microsoft.com/0248b200-37cd-47d5-8767-0120028fa78c