Develop anywhere - A practical guide to using packages with webMethods.io
Tags: webmethods, integration, packages, superipaas
Published: 2023-11-20 11:41:15

---
title: Develop anywhere - A practical guide to using packages with webMethods.io
published: true
date: 2023-11-14 10:10:15 UTC
tags: webMethods, integration, packages, SuperiPaaS
canonical_url: https://tech.forums.softwareag.com/t/develop-anywhere-a-practical-guide-to-using-packages-with-webmethods-io/286024
---

 

_products versions - {webMethods Integration 11.0 or above}_

## Introduction

Develop Anywhere, Deploy Anywhere introduces a new unified integration platform for webMethods and builds on the strengths of our existing products.

In this article, I will show how you can take a webMethods package developed with Service Designer and incorporate it into an Integration project for use and deployment anywhere!

[![custom-packages](https://global.discourse-cdn.com/techcommunity/optimized/3X/4/0/402ec5684273a92b9cbad232bf40ad71484fa08d_2_690x205.png)](https://global.discourse-cdn.com/techcommunity/original/3X/4/0/402ec5684273a92b9cbad232bf40ad71484fa08d.png "custom-packages")

## Pre-requisite

You will need the following

- **[webMethods.io](http://webMethods.io) tenant** that has these new features enabled
- **[Service Designer](https://tech.forums.softwareag.com/t/webmethods-service-designer-download/235227)** installed locally on your computer if you want to version control your own package.
- **GitHub account** to allow you to pull packages without rate limiting.

> **NOTE:** You do not need to use Service Designer 11.0 to build packages that can be deployed in webMethods 11.0 and can reuse older packages that you may have developed in the past. But be careful if you have been using undocumented or deprecated functionality, as they might not be available in the most recent release.

## Steps to follow

In this section, I will list the actions without necessarily going into lots of detail, for this refer to our online [documentation center](https://docs.webmethods.io/integration/starthere/home/index.html)

### Create an integration project

You create a project in [webMethods.io](http://webMethods.io) Integration and it allows you to package a working integration or API. Everything you need to make your integration work goes into the project, including as-of-now webMethods packages.

So login to your [webMethods.io](http://webMethods.io) tenant and select Integration. You will then see your projects page, before we begin verify that you see the option “Integration Runtimes” option in the masthead. If you don’t, then I’m afraid you will need to reach out to your Customer Success Manager (CSM) at Software AG or if not raise a support ticket, before you can continue.

We will now create a fresh project to allow us to experiment, just click on the “+” button and name your project.

[![create-project](https://global.discourse-cdn.com/techcommunity/optimized/3X/c/b/cbf6d9699d9c29a404a37e3a18ea392cbb24234d_2_471x499.png)](https://global.discourse-cdn.com/techcommunity/original/3X/c/b/cbf6d9699d9c29a404a37e3a18ea392cbb24234d.png "create-project")

You will notice a new option that allows you to use your own source control (GitHub only at the moment). This will become really important if you want to be able to build your own edge images for production at a later date. If you have a GitHub account and want to try this out then continue with the next section, otherwise skip to the section on “Create a deploy anywhere flow service”. In which case keep the “Default Server” choice and click the Create button.

### Setting up a GitHub account for your project

You need to complete three steps in order to use your own source control;

- **Create a GitHub repository** - Login to [GitHub.com](http://GitHub.com) and create a new public or private repository for your project. It must have the same name as your project and also end with the word ‘Project’. Do not initialize the repo, keep it empty.
- **Get a developer access token** - In GitHub click your account avatar (top right corner) and click on settings. From settings, click on Developer settings (bottom left) and then finally personal access tokens. From this screen, you can generate a new token. You need only select permissions for ‘repo’ access.
- **Give access to your repository in [webMethods.io](http://webMethods.io)** - You now need to add an account for your developer access token so that [webMethods.io](http://webMethods.io) can push updates to your project. Click on the validate button to verify the pasted token. If it’s valid then the ‘add’ button will become active and you will be able to complete the step.

[![github-add](https://global.discourse-cdn.com/techcommunity/optimized/3X/7/5/7509fd47826e9e78f9aea5be2d1b63a0d88b0a49_2_400x500.png)](https://global.discourse-cdn.com/techcommunity/original/3X/7/5/7509fd47826e9e78f9aea5be2d1b63a0d88b0a49.png "github-add")

After adding your git account you will be returned to the “New Project” modal and allowed to set the branch name for your initial version. Click Create to create your project, refresh your repo page and you should see the project assets newly created.

> The git repository must be empty or it will fail, and the repository cannot be shared we require a unique repo for each project.

### Create a deploy anywhere flow service

Firstly we need to explain that we now have two variants to our flow services;

- _Flow Service_ - Pre-existing flow service that you know and love.
- _Deploy Anywhere Flow Service_ - Can be deployed to a runtime of your choice anywhere.

Only deploying anywhere flow services can leverage packages as they run in an isolated spoke or in your own environment and hence the risk presented by 3rd party packages to our infrastructure is mitigated.

> This is a good time to remind you that you should also vet any 3rd party packages that you did not develop before introducing them into your integrations.

So from your projects page, click on flow services, then the ‘+’ button, select “deploy anywhere flow service” and add.

The deploy anywhere flow editor is the same as the flow editor and I won’t try to explain the ins and outs of writing flow services here as it is outside the scope of this article. However, I would like to bring to your attention the addition of the runtime chooser to the masthead. This chooser allows you to test/debug your deploy anywhere flow service on a runtime of your choice, by default it preselects the cloud runtime that has been provisioned in your [webMethods.io](http://webMethods.io) tenant.

[![deploy-anywhere-editor](https://global.discourse-cdn.com/techcommunity/optimized/3X/8/e/8e68e5ad46e2293b8b840901e668abbf8f386985_2_690x131.png)](https://global.discourse-cdn.com/techcommunity/original/3X/8/e/8e68e5ad46e2293b8b840901e668abbf8f386985.png "deploy-anywhere-editor")

> It is important to note that this choice is not permanent and the chooser exists only as a convenience. Where this service gets executed is entirely devolved to the orchestration layer, which is implemented using workflows.

So let’s get your service to simply log a hello message to the selected runtime log;

- **Name your service** - Click on the service name in the top left corner and type ‘helloWorld’
- **Add an input** - Click in the i/o button add an new input ‘name’
- **Add a log step** - Click on the first step and start typing ‘log’ and select ‘debugLog’ from the suggestion.
- **Set the input** - Click on the ‘View/Edit pipeline’ button and double-click on the message input. Toggle the ‘Perform variable substitution’ to true and start typing ‘Hello %’, complete by selecting ‘name’ from the suggestions.

Now click on the run button next to the ‘runtime’ chooser, enter a name when prompted for input and hey presto you have just executed your first deploy anywhere flow service in a dedicated cloud runtime.

Not so excited? Well, we haven’t done anything very different from a typical flow service as of yet. What we need is to be able to see how we can use a custom package and then deploy anywhere.

### Adding a 3rd party package

You can add virtually any package that you have developed in the past or present. This is great news as it allows you to share and reuse common logic and services between projects and developers.

The only technical constraint is that the version of your package cannot be higher than the version of the runtime into which you want to install it. Obviously, that will be impossible as of now (when this article was published) because our cloud platform is already at version 11.0 and you will be using either Service Designer 10.15 or our preview version of 11.0, and yes 10.15 is fine by the way. However, there are caveats if you want a project that is reliable and efficient, so please consider the following;

- **Small is good** - Avoid huge monolithic packages as this will result in fat slow containers. Testing will also be more complicated and change management difficult to judge.
- **Deprecation** - Generally our platform maintains good backward compatibility, but that doesn’t mean that we will keep deprecated services or assets in the product forever, so be aware that really old packages that haven’t been maintained might run into trouble.
- **Stateless** - Runtimes are stateless so services that write to the file system to record state risk failing, caches will not be shared across replicas. Packages will have to be refactored if the local state is assumed.
- **autonomous** - Ensure that the package has everything it needs to work self-contained in the package. For instance, if it is dependent on a configuration file or Java library, ensure that they are both in the package under the config and code/jars folders respectively. resources is another folder that you can make sure of to localize any other type of file.

With that in mind, let’s add a package to our project and see how we can then invoke services in the package. Your packages must be version-controlled in a dedicated GitHub repository. We enforce that to ensure that proper version control and collaboration are respected. To start with we will use one of my packages that are already available via a GitHub repository and after that, I have included a section walking you through the steps to get your own package into GitHub.

### OpenWeather client package

The package that we will use here was kindly contributed by [@Radhika\_Warrier\_Mooriyath](https://tech.forums.softwareag.com/u/radhika_warrier_mooriyath) and [@Rahul\_Singh11](https://tech.forums.softwareag.com/u/rahul_singh11), and it shows how we can leverage the [Open Weather](https://openweathermap.org) service to provide a set of simple services to find out what the weather is like. This is especially useful if you have perhaps created packages for calling back-end for on-premise applications in the past, and now you can bring them into your hybrid integrations without having to rewrite any of your code.

> The package leverages our support for importing OpenAPI 3.0 definitions directly into Service Designer that then generates the services for you. For more information refer to our document on [webMethods Service Development Help 10.15](https://documentation.softwareag.com/webmethods/designer/sdf10-15/webhelp/sdf-webhelp/pdf/service-development-help.pdf), chapter 23, page 471.

To add this package from your project page click on the packages tab and you should see something like below

[![packages](https://global.discourse-cdn.com/techcommunity/optimized/3X/b/f/bf55c2193ee39b7adba62e4417453aabfaac717c_2_690x263.png)](https://global.discourse-cdn.com/techcommunity/original/3X/b/f/bf55c2193ee39b7adba62e4417453aabfaac717c.png "packages")

Here we see that we already have a package listed, namely the project package that comprises our deploy anywhere flow services. We will now add our package by clicking on the “Add package” button, then select the GIT option and paste the following string

```
https://github.softwareag.com/rahs/OpenWeatherClient.git

```

In the source control chooser, select the same git account that you created earlier. Although the repository is public you still need to provide credentials as this will avoid restrictive download limits depending on your account type. This will be important if you want to deploy the project to many different runtimes later.

It will then ask you to select the branch or tag that you want to clone. This is why we insist on version control as this will allow you to switch different implementations in a controlled manner without sudden inexplicable errors that cannot be controlled. In this case, we only have the main branch to choose from.

### Package conflicts

When selecting your version, you may see a hint such as the one below. This is because all of your packages including the project package have to be saved to a design runtime, which currently is the Cloud Runtime provisioned in your tenant. You cannot have different versions of the same package in the same runtime and hence if someone has already imported the same package in a different project you will get this kind of warning.

[![package-conflict](https://global.discourse-cdn.com/techcommunity/optimized/3X/6/e/6e5027864fa43c596b4614142b61ab57f9d6c024_2_690x197.png)](https://global.discourse-cdn.com/techcommunity/original/3X/6/e/6e5027864fa43c596b4614142b61ab57f9d6c024.png "package-conflict")

In this case, it will not replace the existing package with an inferior version and only upload the package if newer than the current version. In which case you may want to inform the owner of the other project as they may need to check that their project is still compatible.

> It is good practice to ensure that your packages maintain backward compatibility. Don’t remove or rename services, ensure existing signature remains compatible, and new inputs should always be optional or have an implicit default value. Remember to use deprecation if you need to replace a service where the change cannot be made transparent.

### Changing the version or getting updates

If you want to replace the package with a new version, or if working on a main branch then you can pull the latest changes from the package details page as below.

[![openweather-package](https://global.discourse-cdn.com/techcommunity/optimized/3X/b/d/bd76a70b896d121272125430849decd2c438c4c5_2_690x263.png)](https://global.discourse-cdn.com/techcommunity/original/3X/b/d/bd76a70b896d121272125430849decd2c438c4c5.png "openweather-package")

Here you can also see what other projects are referencing the package, view the package contents via ‘assets’, and pull the latest changes or even change the current version.

### signup with [OpenWeather.org](http://OpenWeather.org)

Before we can continue you will need to register with the OpenWeather org to get an app id so that you are allowed to execute the service. Don’t worry there is a free plan that you can try out after you register [here](https://home.openweathermap.org/users/sign_up), it’s limited to 60 calls per minute but should suffice for our demo purposes.

You will need to copy the default API key that is automatically generated, either from the email that you receive after registering or via the web portal under your profile, My API keys.

### Invoke a service in the package

Okay, now have successfully added our package to the project let’s go back to our deploy anywhere flow service helloWorld, and see how we can invoke a service in our package.

Deploy anywhere flow services introduce a new category when adding a step called “package services”. If you select this, you will then see that it first presents a list of all your imported packages, select our OpenWeather package, and then start typing “Curr” into the service selector and then pick CurrentWeatherData.

[![invoke-2](https://global.discourse-cdn.com/techcommunity/optimized/3X/8/1/814562cc37d63f529224ed2be85b9634d17ccf5e_2_690x196.png)](https://global.discourse-cdn.com/techcommunity/original/3X/8/1/814562cc37d63f529224ed2be85b9634d17ccf5e.png "invoke-2")

From the “edit pipeline” view enter your city of choice into the input and the app id that you obtained earlier. The app id is really important, otherwise you will get an “Authorization required” exception when running the service.

[![edit-pipeline](https://global.discourse-cdn.com/techcommunity/optimized/3X/1/f/1f0903ea5b1d7927961fe761154f7a7989651c8a_2_690x338.jpeg)](https://global.discourse-cdn.com/techcommunity/original/3X/1/f/1f0903ea5b1d7927961fe761154f7a7989651c8a.jpeg "edit-pipeline")

Save and run the service and you should see something like the below after the execution:

[![run](https://global.discourse-cdn.com/techcommunity/optimized/3X/b/9/b9ebcd15cec48d1e627ec9d73da3c0883f0ce62b_2_688x499.png)](https://global.discourse-cdn.com/techcommunity/original/3X/b/9/b9ebcd15cec48d1e627ec9d73da3c0883f0ce62b.png "run")

Oh dear, it’s raining in Paris!!

Congratulations you have successfully imported and used a webMethods package in your integration project. If you chose to run your service on your own runtime, then the package would automatically be included as part of the deployment.

### Extra brownie points or how to version control your own packages

This section is optional, but I thought I would add it for those who would like to know the steps to get their own packages into a Git repository. You can skip this if you wish.

To get your own package into a Git repository you will need access to the packages folder of your local development environment and a GitHub account.

First, in GitHub create a new git repository and name it the same as your package and do not initialize it with a README as the repository will need to be empty. After creation, you should see something like the following

[![nwe-github](https://global.discourse-cdn.com/techcommunity/optimized/3X/e/6/e6b1e19773fc0d3ddc0a3ad6f3e00aed98972ffd_2_690x311.png)](https://global.discourse-cdn.com/techcommunity/original/3X/e/6/e6b1e19773fc0d3ddc0a3ad6f3e00aed98972ffd.png "nwe-github")

You can follow the instructions other than the “add” command, but first make sure that you are at the root level of your package, before running the commands

```
$ cd <SAG_HOME>/IntegrationServer/packages/MyGreatPackage
$ git init
$ git add .
$ git commit -S -m "Moving my package to a git repo for the first time!"
$ git branch -M main
$ git remote add origin https://github.com/............
$ git push -u origin main

```

> The -S option on the commit command ensures that the update is cryptographically signed, but will require that you have shared a GPG key/pair with your git account ([Github docs on signing commits](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/about-commit-signature-verification)). You can remove it if you haven’t done this, but I would recommend configuring it especially if you want to share the package with the outside world as it will allow you to verify the version and reassure the developers who want to use your package.

Once done reload the web page and you will see that the commands have been replaced with your package contents.

[![git-added](https://global.discourse-cdn.com/techcommunity/optimized/3X/5/b/5b2c10fe355ae17a653a6837c28d12dfc75ddc54_2_588x500.jpeg)](https://global.discourse-cdn.com/techcommunity/original/3X/5/b/5b2c10fe355ae17a653a6837c28d12dfc75ddc54.jpeg "git-added")

> You will notice that in the above screenshot, the package is documented thanks to the included README.md file. As of webMethods 10.15 a README.md file is created automatically when creating a new package and we would recommend that you regularly update this file to help other developers better use your package. For packages created with older versions of webMethods just create the file manually beforehand.

### Make your package deployable

As already mentioned you need to ensure that your package can be easily deployed and without requiring additional steps as that will break the one-click deployment offered by Deploy Anywhere. Keep in mind the following practices.

- Keep packages small and ensure a README.md file is included.
- Implement versioning and ensure that the version and build is updated in the manifest.v3 file.
- Explicitly define dependencies on other packages via the dependencies section in the manifest.v3 file.
- Make sure that your package is autonomous and has no external dependencies.
- Avoid manual steps by automating pre/post actions via startup & shutdown services (keep them short & sweet, otherwise you can adversely affect the startup and shutdown time of your container)

## Next steps

- Register your own runtimes in the Integration Runtimes control plane.
- Start orchestrating your services across different runtimes via workflows.
- Share your package with other developers via the Software AG package registry at [https://packages.softwareag.com](https://packages.softwareag.com)

## Useful links | Relevant resources

Overview - [What is Develop Anywhere, Deploy Anywhere?](https://tech.forums.softwareag.com/t/what-is-develop-anywhere-deploy-anywhere/284756)  
Sign up for a tenant - [Sign up - Software AG Cloud](https://signup.softwareag.cloud/#/basic-b)  
Online documentation - [docs.webmethods.io](https://docs.webmethods.io/)  
Check out are YouTube videos on super IPaaS - [Youtube - Super IPaaS](https://www.youtube.com/results?search_query=Super+IPaaS)  
Download the latest version of Service Designer [here](https://tech.forums.softwareag.com/t/webmethods-service-designer-download/235227)  
Check out available packages - [Software AG package registry](https://packages.softwareag.com)


[Read full topic](https://tech.forums.softwareag.com/t/develop-anywhere-a-practical-guide-to-using-packages-with-webmethods-io/286024)