Visual Studio BizTalk Schema Generator Wizard error: Error occurred while creating the BizTalk port configuration file

Visual Studio BizTalk Schema Generator Wizard error: Error occurred while creating the BizTalk port configuration file

After several days migrating BizTalk open-source contributions like BizTalk Mapper Extensions UtilityPack, BizTalk Pipeline Components Extensions Utility Pack, BizTalk MapperExtensions Functoid Project Template, BizTalk MapperExtensions Functoid Wizard and several tools like BizTalk Filter Finder Tool, BizTalk Bindings Exporter Tool, or BizTalk Port Multiplier Tool for BizTalk Server 2020. It is time to get back to one of my favorite topics error and warnings, cause, and solutions blog post. This time on a small development issue that I got recently while I was trying to Consume Adapter Service to generate the Oracle schemas inside Visual Studio.

I have done these thousands of times and it is a very straightforward task once you know how to communicate with Oracle system but this time I got the following error:

Error occurred while creating the BizTalk port configuration file. Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Consume Adapter Service Schema Generator BizTalk port configuration error

A curiosity is that the Wizard was able to successfully generate the Oracle Schemas. The problem occurred while it was trying to generate the Binding file.

Cause

Unfortunately, I don’t know exactly the cause reason for this error. In my view, the same occurred due to some special character coming from the Oracle resources that are being consumed or incompatibilities between Oracle data types and .NET data types and that are used to generate the Binding file.

Nevertheless, this is not a stopping issue. You still have all the necessary BizTalk resources generated by the wizard: the Oracle schemas. The only thing that is not generated is the binding file, which is extremely useful to create the receive or send port in the BizTalk Server Administration Console. However, despite this constraint, you are still able to manually create the port without requiring the binding file.

Solution

Well, you know me, it is possible to manually create the ports without requiring the binding files, however, this is an accelerator that I prefer not to lose. So, I had to investigate and solve this problem, before it appears more often.

And in fact, the solution is quite easy:

  • On the Consume Adapter Service Schema Generator Wizard, while you are configuring the connection string to Oracle, configure the URI, select the Binding Properties tab.
Consume Adapter Service Schema Generator BizTalk port configuration solution
  • On the Binding Properties tab, scroll down to the Metadata section. There you will find a property called: EnableSafeTyping.
    • This feature controls how the adapter surfaces certain Oracle data types and by default this value is false.
  • To solve this issue you need to change the EnableSafeTyping value to true.
Consume Adapter Service Schema Generator BizTalk port configuration solution

Since not all .NET and Oracle types are created equally, we occasionally need to set the value true for this property to handle some constraints around data types.

This is not a unique Oracle issue, this same error may happen when you are trying to generate schemas from SAP also.

The post Visual Studio BizTalk Schema Generator Wizard error: Error occurred while creating the BizTalk port configuration file appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk Server 2020 – 20 days, 20 posts: BizTalk MapperExtensions Functoid Wizard for BizTalk Server 2020

BizTalk Server 2020 – 20 days, 20 posts: BizTalk MapperExtensions Functoid Wizard for BizTalk Server 2020

BizTalk Server 2020 – 20 days, 20 posts – day 5. I will finish my challenge regardless of all these constraints we are facing, and that limits our free time. So, while my wife was sleeping our cute little monster yesterday, I was able to migrate this tool and test it to be compatible with BizTalk Server 2020. Today while she is doing the same, I’m publishing this productivity tool for those that love BizTalk Mapper as I do: BizTalk MapperExtensions Functoid Wizard. Once again, I hope you enjoy and find this tool useful. 

BizTalk MapperExtensions Functoid Wizard

BizTalk MapperExtensions Functoid Wizard is a Custom Functoid Project Wizard for Visual Studio 2019. It allows you to create new Functoids project for BizTalk Server 2020 without having to create manually the project, in other words, having to manually create:

  • A new class library project in Visual Studio;
  • Add a reference to the Microsoft.BizTalk.BaseFunctoids assembly;
  • Add New Class and having to code the entire class;

This Wizard will do this process automatically, and used in conjunction with Item Template for Visual Studio: Custom BizTalk Functoid will facilitate and significantly expedite the development process of our projects.

BizTalk MapperExtensions Functoid Wizard Installation

To use this project template download the executable files available on the Installation Files folder and run the setup file.

Once you run the setup file follow these steps:

  • On the Welcome to the BizTalk MapperExtensions Functoid Template Setup Wizard screen, click Next.
BizTalk Server 2020 MapperExtensions Functoid Wizard Welcome Screen
  • On the Select Installation Folder screen, select the folder where you want to install the Wizard and select the option Everyone. Click Next to continue.
BizTalk Server 2020 MapperExtensions Functoid Wizard Installation folder Screen
  • On the Confirm Installation screen, confirm your intent to install by clicking Next.
BizTalk Server 2020 MapperExtensions Functoid Wizard Confirm Screen
  • On the Installation Complete screen, click close and the installation is complete.
BizTalk Server 2020 MapperExtensions Functoid Wizard Complete Screen

Now you can see a new BizTalk project Wizard on Visual Studio 2019. Unfortunately, Visual Studio 2019 has a completely different look and fill and you will not be able to see this project under “BizTalk” projects in your Visual Studio 2019, instead, you need to search for it or scroll down to find it.

Visual Studio 2019 BizTalk Server Functoid Project option

I still need to find a way to solve this limitation or release a different approach to solve this issue and have a more friendly approach.

Create New Functoid Project

To create a new functoid using this project template choose the option BizTalk Server Functoid Project in Visual Studio 2019 and a Wizard will pop-up. Follow the requirements of this wizard to create the Functoid.

  • In the Start screen, click Next to continue.
BizTalk MapperExtensions Functoid Wizard: Start Screen
  • In the General Project Properties screen, fill the Functoid class name, namespace and create or select a new Strong Key (you can use an existing one). Click Next to continue.
BizTalk MapperExtensions Functoid Wizard: General Properties Screen
  • In the Functoid Properties screen, define the Functoid ID (must be greater than 10000), the functoid name, the tooltip (short description) and description (full description). Click Next to continue.
BizTalk MapperExtensions Functoid Wizard: Functoid Properties Screen
  • In the second Functoid Properties screen, choose the functoid category and the implementation language (the language in which you want to implement your functoid behavior code): C# or VB.NET. Click Next to continue.
BizTalk MapperExtensions Functoid Wizard: Functoid Properties Screen
  • In the Functoid Parameters and Connection Type” screen, define the functoid function name, function inputs and types and output and types. Click Next to continue.
BizTalk MapperExtensions Functoid Wizard: Functoid Parameters Screen
  • On the final screen, click Finish to create the Visual Studio project.
BizTalk MapperExtensions Functoid Wizard: Result Screen

Visual Studio will create a new Project based on your implementation language and definitions provided in the Wizard.

Visual Studio 2019 BizTalk Server Functoid Project sample
  • Open the generated class and implement your code

Other versions

This tool is also available for the following BizTalk Server versions:

Download

You can download the source code from:
BizTalk MapperExtensions Functoid Wizard for BizTalk Server 2020BizTalk MapperExtensions Functoid Wizard for BizTalk Server 2020
GitHub

The post BizTalk Server 2020 – 20 days, 20 posts: BizTalk MapperExtensions Functoid Wizard for BizTalk Server 2020 appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk JSON Schema Wizard: Error in JSON Instance File.XMLNodeConverter can only convert JSON that begins with an object

BizTalk JSON Schema Wizard: Error in JSON Instance File.XMLNodeConverter can only convert JSON that begins with an object

This week while trying to use the BizTalk Server 2016 JSON Schema Wizard to generate an XML schema from a specific JSON file to be sent to a Logic App I got the following error:

Error in JSON Instance File.XMLNodeConverter can only convert JSON that begins with an object. Path ‘’, line 1, position 1.

The JSON file had the following format:

[
  {
    "IntID": 208,
    "ItemLogID": 14255826,
    "Step": "IN",
    "BusinessUnit": "TST",
  },
  {
    "IntID": 209,
    "ItemLogID": 14257419,
    "Step": "IN",
    "BusinessUnit": "TST",
  }
]

Basically, I’m trying to send a list of “objects” that in my case are Locks, to be processed.

Cause

The cause of this “problem” is that a JSON array of objects, it may not make sense in a BizTalk Server XML world as Morten la Cour very well written in this forum. At that sentence, I will add: “at it his being done today”. Because with a few improvements could be smarter and support this type of messages.

Why? The BizTalk
JSON Schema Wizard is a simple and “stupid” converter, it will ask only for you
to provide a root node and a namespace that it will add to the XML Schema and
the XML JSON representation because it will require that information to be able
to uniquely identify this type of message.

But it will not understand what is a “not identified” object array because it needs to give it a Record name in the XML equivalent.

So, that means
that it will not support JSON arrays?

No, it will support JSON arrays if you provide a field name to that array, i.e., instead of having:

[
…
]

You should have:

{
   "field name": [
   …
   ]
}

Solution

If you don’t have the control over that JSON message,
you may need to create a custom pipeline component to add or remove this field
name that will identify the array in the XML equivalent message.

If you have control over the structure of the JSON
message the simple way is to modify the structure of the message to include a
field name to identify the array. Lucky it was my case, so I modify the
original structure descrived above to be:

  {
    "locks": [
    {
      "IntID": 208,
      "ItemLogID": 14255826,
      "Step": "IN",
      "BusinessUnit": "TST",
    },
    {
      "IntID": 209,
      "ItemLogID": 14257419,
      "Step": "IN",
      "BusinessUnit": "TST",
    }
  ]
}

Now, if I try to run the BizTalk JSON Schema Wizard
against this message it will be able to create the JSON Schema.

The post BizTalk JSON Schema Wizard: Error in JSON Instance File.XMLNodeConverter can only convert JSON that begins with an object appeared first on SANDRO PEREIRA BIZTALK BLOG.