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…

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,

BizTalk 2012 R2 and REST Example Walkthrough

The recent BizTalk 2012 R2 release has inbuilt REST support for both exposing, and consuming a REST service using the WebHttp binding

In this blog post I will provide a walkthrough on how to configure BizTalk to:

  1. Expose an Orchestration as REST service (POST).
  2. Consume a REST service (POST).

We will use the Hello World orchestration example that is part of the SDK.

  1. Expose an Orchestration as REST service (POST):
    1. Deploy the HelloWorld Orchestration sample and test to make sure everything works as expected
    2. Modify the receive port
      1. Modify the Transport type to use WCF-WebHttp and click to configure

      2. Update the url mapping to the following, the operation name string should be the same operation name used in the orchestration.

        <BtsHttpUrlMapping>

        <Operation Name=”Operation_1″ Method=”POST” Url=”/HelloWorld”/>

        </BtsHttpUrlMapping>



      3. Save and restart the orchestration and BizTalk Services.
      4. Launch Fiddler and submit a request to the url http://localhost/HelloWorld and you will see a new file created in the folder C:\Program Files (x86)\Microsoft BizTalk Server 2010 R2\SDK\Samples\Orchestrations\HelloWorld\Out (note: this is the default installation path).

  2. Consume a Rest service (POST)
    1. Create a new MVC app, with webapi controller and modify the the Post method of the ValuesController to the following to accept a generic HttpRequestMessage (or you could probably do an xsd.exe and import the generated cs file into the mvc project and add it as an parameter, this I will cover in the later posts).
      1. public
        void Post(HttpRequestMessage value)

    2. Modify the send port:
      1. Modify the transport to use Wcf-WebHttp binding and click on configure

      2. Update the url mapping to the following, the operation name string should be the same operation name used in the orchestration.

        <BtsHttpUrlMapping>

        <Operation Name=”Operation_1″ Method=”POST” Url=”/api/values/post”/>

        </BtsHttpUrlMapping>

      3. And in the post you could probably send it to another downstream service or write it to a file or something.
  3. In the upcoming posts I will show you on how to use other the other http verbs, use cases and add JSON support.

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