The Azure DocumentDB Blog

All about DocumentDB and Logic Apps

Month: January 2016 (page 1 of 5)

Using a Swagger from an Azure Connector

I recently added the BizTalk Transform Service Connector to a Logic App

When clicking on properties,  I discovered that I could access the API Definition as shown in the following figure

add

 

I found that I was able to download the  Swagger, TransformService.json, by clicking on  Download Swagger

swagger

The contents of the Swagger are shown below.

{
  "swagger": "2.0",
  "info": {
    "version": "1.0",
    "title": "BizTalk Transform Service"
  },
  "host": "transformservice5c0f3e70d14e444abd3b23a237533c15.azurewebsites.net",
  "schemes": [
    "http"
  ],
  "paths": {
    "/api/Transform": {
      "post": {
        "tags": [
          "Transform"
        ],
        "summary": "Transform",
        "description": "Transform action converts XML message from one format to another using the specified map that was already uploaded to Transform API App. If no map is specified, the map is automatically picked based on the source schema to which input XML conforms to.",
        "operationId": "Transform",
        "consumes": [
          "application/json",
          "text/json"
        ],
        "produces": [
          "application/json",
          "text/json"
        ],
        "parameters": [
          {
            "name": "inputXml",
            "in": "body",
            "description": "Specify the valid XML content that will conform to the source schema of a map in Transform API App. This can be an output from previous action in Flow App such as �Call RFC � SAP� or �Insert Into Table � SQL�.",
            "required": true,
            "schema": {
              "$ref": "#/definitions/TransformInput"
            },
            "x-ms-summary": "Input XML"
          },
          {
            "name": "mapName",
            "in": "query",
            "description": "Optional. Specify a valid map name that was already uploaded in Transform API App. If no map is specified, the map is automatically picked based on the source schema to which input XML conforms to.",
            "required": false,
            "x-ms-summary": "Map Name",
            "x-ms-visibility": "advanced",
            "type": "string",
            "default": ""
          }
        ],
        "responses": {
          "200": {
            "description": "Transform action executed successfully.",
            "schema": {
              "$ref": "#/definitions/TransformOutput"
            }
          },
          "400": {
            "description": "Bad Request. Input XML is empty/ Transform map is invalid / Input XML does not conform to the source schema of the map."
          },
          "404": {
            "description": "The specified map does not exist / There is no map configured in Transform API App that accepts the specifed input XML content"
          },
          "500": {
            "description": "Internal server error. A runtime error occured while executing the map. Check the input XML and the map."
          },
          "default": {
            "description": "Operation Failed."
          }
        },
        "deprecated": false
      }
    }
  },
  "definitions": {
    "TransformInput": {
      "description": "Transform Input Model Class",
      "required": [
        "InputXml"
      ],
      "type": "object",
      "properties": {
        "InputXml": {
          "description": "Specify the valid XML content that will conform to the source schema of a map in Transform API App. This can be an output from previous action in Flow App such as �Call RFC � SAP� or �Insert Into Table � SQL�.",
          "type": "string",
          "x-ms-summary": "Input XML"
        }
      }
    },
    "TransformOutput": {
      "description": "Transform Output Model Class",
      "required": [
        "OutputXml"
      ],
      "type": "object",
      "properties": {
        "OutputXml": {
          "description": "XML content that is created based on the input XML content using the specified map",
          "type": "string",
          "x-ms-summary": "Output XML"
        }
      }
    }
  }
}

I can use the “Add Rest Client” in Visual Studio to add the TransformService  API Service to my custom API or Web Application.

The key advantage of doing this is that i am able to call the TransformService outside a workflow.  I can do my mapping before the first step in as Logic App.

 

 

Generated code from my DocDB REST API SWagger

I generated both Client and Server (stub) code from my DocumentDB REST API

The  following table lists the Client Code:

Name Description
 Clojure  Clojure is a dynamic, general-purpose programming language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure is a compiled language, yet remains completely dynamic – every feature supported by Clojure is supported at runtime. Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection.
 Scala  Seamless Java Interop. Scala runs on the JVM, so Java and Scala stacks can be freely mixed for totally seamless integration.
 Typescript – Node  TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.

The TypeScript API exposed to nodejs. Use to compile typescript code in memory

Objective-C  Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. It is the main programming language used by Apple for the OS X and iOS operating systems, and their respective application programming interfaces (APIs): Cocoa and Cocoa Touch.
 C++ with QT  Qt is a cross-platform application development framework for desktop, embedded and mobile. Supported Platforms include Linux, OS X, Windows, VxWorks, QNX, Android, iOS, BlackBerry, Sailfish OS and others.Qt is not a programming language by its own. It is a framework written in C++. A preprocessor, the MOC (Meta-Object Compiler), is used to extend the C++ language with features like signals and slots. Before the compilation step, the MOC parses the source files written in Qt-extended C++ and generates standard compliant C++ sources from them. Thus the framework itself and applications/libraries using it can be compiled by any standard compliant C++ compiler like Clang, GCC, ICC, MinGW and MSVC.
 Akka – Scala  FAQ
 Dart  Dart is an open-source, scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps.
 Jmeter  The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
 Java  Building the API client library requires Maven  to be installed.
 JavaScript
 Tizen  Official Site
 Android  Android API -While most Android applications are written in Java-like language, there are many differences between the Java API and the Android API, and Android does not use a Java Virtual Machine but two other ones called either Dalvik or Android Runtime (ART).

There is no Java Virtual Machine in the Android platform. Java bytecode is not executed. Instead Java classes are compiled into a proprietary bytecode format and run on Dalvik, a specialized virtual machine (VM) designed specifically for Android. Unlike Java VMs, which are stack machines, the Dalvik VM is a register-based architecture.

 Ruby  Official Site
 Perl   Official Site
 Flash  ActionScrpt  –   Official Site
 Async – Scala AsyncScala projects provide Scala implementation of asynchronous control constructs from E programming language and some additional control constructs inspired by Occam.

The AsyncScala  framework simplifies writing asynchronous event-driven dataflow-based applications in Scala. It mainly builds upon ideas and syntax of E programming language. However, it also draws ideas from other programming languages like Occam and frameworks like SEDA as well. In addition to core library that supports common asynchronous communication patterns. The framework provides a wrapper for NIO-based sockets that simplify creation of network applications that support a high number of concurrent connections.

 Python    Official Site
 HTML  Used for documentation
 Dynamic – HTML  Used for documentation
Typescript – Angular  Using TypeScript with AngularJS and Web API

If you would like access to the generated client code please fill in the form below:

[ninja_form id=6]

Older posts
%d bloggers like this:
Skip to toolbar